OmniSciDB  e465130ba1
 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)
 
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 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 ()
 

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 869 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 872 of file RelAlgDagBuilder.h.

References RelAlgNode::inputs_.

876  : groupby_count_(groupby_count), agg_exprs_(std::move(agg_exprs)), fields_(fields) {
877  inputs_.push_back(input);
878  }
std::vector< std::shared_ptr< const RelAlgNode > > inputs_
const size_t groupby_count_
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 321 of file RelAlgDagBuilder.cpp.

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

321  {
322  std::vector<std::unique_ptr<const RexAgg>> aggs_copy;
323  for (auto& agg : agg_exprs_) {
324  auto copy = agg->deepCopy();
325  aggs_copy.push_back(std::move(copy));
326  }
327  return std::make_shared<RelAggregate>(groupby_count_, aggs_copy, fields_, inputs_[0]);
328 }
std::vector< std::shared_ptr< const RelAlgNode > > inputs_
const size_t groupby_count_
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 905 of file RelAlgDagBuilder.h.

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

905  {
906  return agg_exprs_;
907  }
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 901 of file RelAlgDagBuilder.h.

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

Definition at line 884 of file RelAlgDagBuilder.h.

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

Definition at line 893 of file RelAlgDagBuilder.h.

References run_benchmark_import::result.

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

Definition at line 891 of file RelAlgDagBuilder.h.

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

Definition at line 886 of file RelAlgDagBuilder.h.

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

Definition at line 882 of file RelAlgDagBuilder.h.

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

882 { return groupby_count_; }
const size_t 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 909 of file RelAlgDagBuilder.h.

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

Definition at line 887 of file RelAlgDagBuilder.h.

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

Implements RelAlgNode.

Definition at line 880 of file RelAlgDagBuilder.h.

880 { 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 913 of file RelAlgDagBuilder.h.

References run_benchmark_import::result, and to_string().

913  {
914  std::string result = "(RelAggregate<" +
915  std::to_string(reinterpret_cast<uint64_t>(this)) + ">(groups: [";
916  for (size_t group_index = 0; group_index < groupby_count_; ++group_index) {
917  result += " " + std::to_string(group_index);
918  }
919  result += " ] aggs: [";
920  for (const auto& agg_expr : agg_exprs_) {
921  result += " " + agg_expr->toString();
922  }
923  return result + " ])";
924  }
std::string to_string(char const *&&v)
const size_t groupby_count_
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 930 of file RelAlgDagBuilder.h.

Referenced by deepCopy().

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

Definition at line 931 of file RelAlgDagBuilder.h.

Referenced by deepCopy().

const size_t RelAggregate::groupby_count_
private

Definition at line 929 of file RelAlgDagBuilder.h.

Referenced by deepCopy().


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