OmniSciDB  8fa3bf436f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RelAggregate Class Reference

#include <RelAlgDagBuilder.h>

+ Inheritance diagram for RelAggregate:
+ Collaboration diagram for RelAggregate:

Public Member Functions

 RelAggregate (const size_t groupby_count, std::vector< std::unique_ptr< const RexAgg >> &agg_exprs, const std::vector< std::string > &fields, std::shared_ptr< const RelAlgNode > input)
 
 RelAggregate (RelAggregate const &)
 
size_t size () const override
 
const size_t getGroupByCount () const
 
const size_t getAggExprsCount () const
 
const std::vector< std::string > & getFields () const
 
void setFields (std::vector< std::string > &new_fields)
 
const std::string getFieldName (const size_t i) const
 
std::vector< const RexAgg * > getAggregatesAndRelease ()
 
std::vector< std::unique_ptr
< const RexAgg > > 
getAggExprsAndRelease ()
 
const std::vector
< std::unique_ptr< const
RexAgg > > & 
getAggExprs () const
 
void setAggExprs (std::vector< std::unique_ptr< const RexAgg >> &agg_exprs)
 
std::string toString () const override
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
void addHint (const ExplainedQueryHint &hint_explained)
 
const bool hasHintEnabled (QueryHint candidate_hint) const
 
const ExplainedQueryHintgetHintInfo (QueryHint hint) const
 
bool hasDeliveredHint ()
 
HintsgetDeliveredHints ()
 
- Public Member Functions inherited from RelAlgNode
 RelAlgNode (RelAlgInputs inputs={})
 
virtual ~RelAlgNode ()
 
void resetQueryExecutionState ()
 
void setContextData (const void *context_data) const
 
void setOutputMetainfo (const std::vector< TargetMetaInfo > &targets_metainfo) const
 
const std::vector
< TargetMetaInfo > & 
getOutputMetainfo () const
 
unsigned getId () const
 
bool hasContextData () const
 
const void * getContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
std::shared_ptr< const RelAlgNodegetAndOwnInput (const size_t idx) const
 
void addManagedInput (std::shared_ptr< const RelAlgNode > input)
 
bool hasInput (const RelAlgNode *needle) const
 
virtual void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)
 
bool isNop () const
 
void markAsNop ()
 
void clearContextData () const
 

Private Attributes

const size_t groupby_count_
 
std::vector< std::unique_ptr
< const RexAgg > > 
agg_exprs_
 
std::vector< std::string > fields_
 
bool hint_applied_
 
std::unique_ptr< Hintshints_
 

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
RelAlgInputs inputs_
 
const unsigned id_
 

Detailed Description

Definition at line 960 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

RelAggregate::RelAggregate ( const size_t  groupby_count,
std::vector< std::unique_ptr< const RexAgg >> &  agg_exprs,
const std::vector< std::string > &  fields,
std::shared_ptr< const RelAlgNode input 
)
inline

Definition at line 963 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

967  : groupby_count_(groupby_count)
968  , agg_exprs_(std::move(agg_exprs))
969  , fields_(fields)
970  , hint_applied_(false)
971  , hints_(std::make_unique<Hints>()) {
972  inputs_.push_back(input);
973  }
const size_t groupby_count_
std::unique_ptr< Hints > hints_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::vector< std::string > fields_
RelAlgInputs inputs_
RelAggregate::RelAggregate ( RelAggregate const rhs)

Definition at line 364 of file RelAlgDagBuilder.cpp.

References addHint(), agg_exprs_, hint_applied_, and hints_.

365  : RelAlgNode(rhs)
366  , groupby_count_(rhs.groupby_count_)
367  , fields_(rhs.fields_)
368  , hint_applied_(false)
369  , hints_(std::make_unique<Hints>()) {
370  agg_exprs_.reserve(rhs.agg_exprs_.size());
371  for (auto const& agg : rhs.agg_exprs_) {
372  agg_exprs_.push_back(agg->deepCopy());
373  }
374  if (rhs.hint_applied_) {
375  for (auto const& kv : *rhs.hints_) {
376  addHint(kv.second);
377  }
378  }
379 }
RelAlgNode(RelAlgInputs inputs={})
void addHint(const ExplainedQueryHint &hint_explained)
const size_t groupby_count_
std::unique_ptr< Hints > hints_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::vector< std::string > fields_

+ Here is the call graph for this function:

Member Function Documentation

void RelAggregate::addHint ( const ExplainedQueryHint hint_explained)
inline

Definition at line 1027 of file RelAlgDagBuilder.h.

References ExplainedQueryHint::getHint(), hint_applied_, and hints_.

Referenced by RelAggregate().

1027  {
1028  if (!hint_applied_) {
1029  hint_applied_ = true;
1030  }
1031  hints_->emplace(hint_explained.getHint(), hint_explained);
1032  }
std::unique_ptr< Hints > hints_
const QueryHint getHint() const
Definition: QueryHint.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr<RelAlgNode> RelAggregate::deepCopy ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1023 of file RelAlgDagBuilder.h.

1023  {
1024  return std::make_shared<RelAggregate>(*this);
1025  }
const std::vector<std::unique_ptr<const RexAgg> >& RelAggregate::getAggExprs ( ) const
inline

Definition at line 1002 of file RelAlgDagBuilder.h.

References agg_exprs_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), and anonymous_namespace{RelAlgExecutor.cpp}::translate_targets().

1002  {
1003  return agg_exprs_;
1004  }
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_

+ Here is the caller graph for this function:

std::vector<std::unique_ptr<const RexAgg> > RelAggregate::getAggExprsAndRelease ( )
inline

Definition at line 998 of file RelAlgDagBuilder.h.

References agg_exprs_.

998  {
999  return std::move(agg_exprs_);
1000  }
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
const size_t RelAggregate::getAggExprsCount ( ) const
inline

Definition at line 981 of file RelAlgDagBuilder.h.

References agg_exprs_.

981 { return agg_exprs_.size(); }
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::vector<const RexAgg*> RelAggregate::getAggregatesAndRelease ( )
inline

Definition at line 990 of file RelAlgDagBuilder.h.

References agg_exprs_, and run_benchmark_import::result.

990  {
991  std::vector<const RexAgg*> result;
992  for (auto& agg_expr : agg_exprs_) {
993  result.push_back(agg_expr.release());
994  }
995  return result;
996  }
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
Hints* RelAggregate::getDeliveredHints ( )
inline

Definition at line 1050 of file RelAlgDagBuilder.h.

References hints_.

Referenced by anonymous_namespace{RelAlgDagBuilder.cpp}::handleQueryHint().

1050 { return hints_.get(); }
std::unique_ptr< Hints > hints_

+ Here is the caller graph for this function:

const std::string RelAggregate::getFieldName ( const size_t  i) const
inline

Definition at line 988 of file RelAlgDagBuilder.h.

References fields_, and i.

988 { return fields_[i]; }
std::vector< std::string > fields_
const std::vector<std::string>& RelAggregate::getFields ( ) const
inline

Definition at line 983 of file RelAlgDagBuilder.h.

References fields_.

983 { return fields_; }
std::vector< std::string > fields_
const size_t RelAggregate::getGroupByCount ( ) const
inline

Definition at line 979 of file RelAlgDagBuilder.h.

References groupby_count_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), and anonymous_namespace{RelAlgExecutor.cpp}::translate_groupby_exprs().

979 { return groupby_count_; }
const size_t groupby_count_

+ Here is the caller graph for this function:

const ExplainedQueryHint& RelAggregate::getHintInfo ( QueryHint  hint) const
inline

Definition at line 1041 of file RelAlgDagBuilder.h.

References CHECK, hasHintEnabled(), hint_applied_, and hints_.

1041  {
1043  CHECK(!hints_->empty());
1044  CHECK(hasHintEnabled(hint));
1045  return hints_->at(hint);
1046  }
const bool hasHintEnabled(QueryHint candidate_hint) const
std::unique_ptr< Hints > hints_
#define CHECK(condition)
Definition: Logger.h:203

+ Here is the call graph for this function:

bool RelAggregate::hasDeliveredHint ( )
inline

Definition at line 1048 of file RelAlgDagBuilder.h.

References hints_.

1048 { return !hints_->empty(); }
std::unique_ptr< Hints > hints_
const bool RelAggregate::hasHintEnabled ( QueryHint  candidate_hint) const
inline

Definition at line 1034 of file RelAlgDagBuilder.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1034  {
1035  if (hint_applied_ && !hints_->empty()) {
1036  return hints_->find(candidate_hint) != hints_->end();
1037  }
1038  return false;
1039  }
std::unique_ptr< Hints > hints_

+ Here is the caller graph for this function:

void RelAggregate::setAggExprs ( std::vector< std::unique_ptr< const RexAgg >> &  agg_exprs)
inline

Definition at line 1006 of file RelAlgDagBuilder.h.

References agg_exprs_.

1006  {
1007  agg_exprs_ = std::move(agg_exprs);
1008  }
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
void RelAggregate::setFields ( std::vector< std::string > &  new_fields)
inline

Definition at line 984 of file RelAlgDagBuilder.h.

References fields_.

984  {
985  fields_ = std::move(new_fields);
986  }
std::vector< std::string > fields_
size_t RelAggregate::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 977 of file RelAlgDagBuilder.h.

References agg_exprs_, and groupby_count_.

977 { return groupby_count_ + agg_exprs_.size(); }
const size_t groupby_count_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::string RelAggregate::toString ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1010 of file RelAlgDagBuilder.h.

References agg_exprs_, cat(), fields_, groupby_count_, RelAlgNode::inputs_, to_string(), and typeName().

1010  {
1011  return cat(::typeName(this),
1012  "(",
1014  ", agg_exprs=",
1015  ::toString(agg_exprs_),
1016  ", fields=",
1017  ::toString(fields_),
1018  ", inputs=",
1019  ::toString(inputs_),
1020  ")");
1021  }
std::string cat(Ts &&...args)
std::string toString() const override
std::string to_string(char const *&&v)
const size_t groupby_count_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::string typeName(const T *v)
Definition: toString.h:82
std::vector< std::string > fields_
RelAlgInputs inputs_

+ Here is the call graph for this function:

Member Data Documentation

std::vector<std::unique_ptr<const RexAgg> > RelAggregate::agg_exprs_
private
std::vector<std::string> RelAggregate::fields_
private

Definition at line 1055 of file RelAlgDagBuilder.h.

Referenced by getFieldName(), getFields(), setFields(), and toString().

const size_t RelAggregate::groupby_count_
private

Definition at line 1053 of file RelAlgDagBuilder.h.

Referenced by getGroupByCount(), size(), and toString().

bool RelAggregate::hint_applied_
private

Definition at line 1056 of file RelAlgDagBuilder.h.

Referenced by addHint(), getHintInfo(), hasHintEnabled(), and RelAggregate().

std::unique_ptr<Hints> RelAggregate::hints_
private

The documentation for this class was generated from the following files: