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

#include <RelAlgAbstractInterpreter.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)
 
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
 
- Public Member Functions inherited from RelAlgNode
 RelAlgNode ()
 
virtual ~RelAlgNode ()
 
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 ()
 

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
std::vector< std::shared_ptr
< const RelAlgNode > > 
inputs_
 
const unsigned id_
 

Detailed Description

Definition at line 867 of file RelAlgAbstractInterpreter.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 870 of file RelAlgAbstractInterpreter.h.

References RelAlgNode::inputs_.

874  : groupby_count_(groupby_count), agg_exprs_(std::move(agg_exprs)), fields_(fields) {
875  inputs_.push_back(input);
876  }
std::vector< std::shared_ptr< const RelAlgNode > > inputs_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::vector< std::string > fields_

Member Function Documentation

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

Implements RelAlgNode.

Definition at line 306 of file RelAlgAbstractInterpreter.cpp.

References agg_exprs_, fields_, groupby_count_, and RelAlgNode::inputs_.

306  {
307  std::vector<std::unique_ptr<const RexAgg>> aggs_copy;
308  for (auto& agg : agg_exprs_) {
309  auto copy = agg->deepCopy();
310  aggs_copy.push_back(std::move(copy));
311  }
312  return std::make_shared<RelAggregate>(groupby_count_, aggs_copy, fields_, inputs_[0]);
313 }
std::vector< std::shared_ptr< const RelAlgNode > > inputs_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::vector< std::string > fields_
const std::vector<std::unique_ptr<const RexAgg> >& RelAggregate::getAggExprs ( ) const
inline

Definition at line 903 of file RelAlgAbstractInterpreter.h.

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

903  {
904  return agg_exprs_;
905  }
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 899 of file RelAlgAbstractInterpreter.h.

899  {
900  return std::move(agg_exprs_);
901  }
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
const size_t RelAggregate::getAggExprsCount ( ) const
inline

Definition at line 882 of file RelAlgAbstractInterpreter.h.

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

Definition at line 891 of file RelAlgAbstractInterpreter.h.

References run_benchmark_import::result.

891  {
892  std::vector<const RexAgg*> result;
893  for (auto& agg_expr : agg_exprs_) {
894  result.push_back(agg_expr.release());
895  }
896  return result;
897  }
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
const std::string RelAggregate::getFieldName ( const size_t  i) const
inline

Definition at line 889 of file RelAlgAbstractInterpreter.h.

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

Definition at line 884 of file RelAlgAbstractInterpreter.h.

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

Definition at line 880 of file RelAlgAbstractInterpreter.h.

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

880 { return groupby_count_; }

+ Here is the caller graph for this function:

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

Definition at line 907 of file RelAlgAbstractInterpreter.h.

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

Definition at line 885 of file RelAlgAbstractInterpreter.h.

885  {
886  fields_ = std::move(new_fields);
887  }
std::vector< std::string > fields_
size_t RelAggregate::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 878 of file RelAlgAbstractInterpreter.h.

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

Implements RelAlgNode.

Definition at line 911 of file RelAlgAbstractInterpreter.h.

References run_benchmark_import::result, and to_string().

911  {
912  std::string result = "(RelAggregate<" +
913  std::to_string(reinterpret_cast<uint64_t>(this)) + ">(groups: [";
914  for (size_t group_index = 0; group_index < groupby_count_; ++group_index) {
915  result += " " + std::to_string(group_index);
916  }
917  result += " ] aggs: [";
918  for (const auto& agg_expr : agg_exprs_) {
919  result += " " + agg_expr->toString();
920  }
921  return result + " ])";
922  }
std::string to_string(char const *&&v)
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 928 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy().

std::vector<std::string> RelAggregate::fields_
private

Definition at line 929 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy().

const size_t RelAggregate::groupby_count_
private

Definition at line 927 of file RelAlgAbstractInterpreter.h.

Referenced by deepCopy().


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