OmniSciDB  bf83d84833
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RelCompound Class Reference

#include <RelAlgDagBuilder.h>

+ Inheritance diagram for RelCompound:
+ Collaboration diagram for RelCompound:

Public Member Functions

 RelCompound (std::unique_ptr< const RexScalar > &filter_expr, const std::vector< const Rex * > &target_exprs, const size_t groupby_count, const std::vector< const RexAgg * > &agg_exprs, const std::vector< std::string > &fields, std::vector< std::unique_ptr< const RexScalar >> &scalar_sources, const bool is_agg, bool update_disguised_as_select=false, bool delete_disguised_as_select=false, bool varlen_update_required=false, TableDescriptor const *manipulation_target_table=nullptr, ColumnNameList target_columns=ColumnNameList())
 
 RelCompound (RelCompound const &)
 
void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input) override
 
size_t size () const override
 
const RexScalargetFilterExpr () const
 
void setFilterExpr (std::unique_ptr< const RexScalar > &new_expr)
 
const RexgetTargetExpr (const size_t i) const
 
const std::vector< std::string > & getFields () const
 
const std::string getFieldName (const size_t i) const
 
const size_t getScalarSourcesSize () const
 
const RexScalargetScalarSource (const size_t i) const
 
void setScalarSources (std::vector< std::unique_ptr< const RexScalar >> &new_sources)
 
const size_t getGroupByCount () const
 
bool isAggregate () const
 
std::string toString () const override
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
void addHint (const HintExplained &hint_explained)
 
const bool hasHintEnabled (const std::string &candidate_hint_name) const
 
const HintExplainedgetHintInfo (const std::string &hint_name) const
 
- 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
 
bool isNop () const
 
void markAsNop ()
 
void clearContextData () const
 
- Public Member Functions inherited from ModifyManipulationTarget
 ModifyManipulationTarget (bool const update_via_select=false, bool const delete_via_select=false, bool const varlen_update_required=false, TableDescriptor const *table_descriptor=nullptr, ColumnNameList target_columns=ColumnNameList())
 
void setUpdateViaSelectFlag () const
 
void setDeleteViaSelectFlag () const
 
void setVarlenUpdateRequired (bool required) const
 
TableDescriptor const * getModifiedTableDescriptor () const
 
void setModifiedTableDescriptor (TableDescriptor const *td) const
 
auto const isUpdateViaSelect () const
 
auto const isDeleteViaSelect () const
 
auto const isVarlenUpdateRequired () const
 
void setTargetColumns (ColumnNameList const &target_columns) const
 
ColumnNameList const & getTargetColumns () const
 
template<typename VALIDATION_FUNCTOR >
bool validateTargetColumns (VALIDATION_FUNCTOR validator) const
 

Private Attributes

std::unique_ptr< const RexScalarfilter_expr_
 
const size_t groupby_count_
 
std::vector< std::unique_ptr
< const RexAgg > > 
agg_exprs_
 
const std::vector< std::string > fields_
 
const bool is_agg_
 
std::vector< std::unique_ptr
< const RexScalar > > 
scalar_sources_
 
const std::vector< const Rex * > target_exprs_
 
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 1269 of file RelAlgDagBuilder.h.

Constructor & Destructor Documentation

RelCompound::RelCompound ( std::unique_ptr< const RexScalar > &  filter_expr,
const std::vector< const Rex * > &  target_exprs,
const size_t  groupby_count,
const std::vector< const RexAgg * > &  agg_exprs,
const std::vector< std::string > &  fields,
std::vector< std::unique_ptr< const RexScalar >> &  scalar_sources,
const bool  is_agg,
bool  update_disguised_as_select = false,
bool  delete_disguised_as_select = false,
bool  varlen_update_required = false,
TableDescriptor const *  manipulation_target_table = nullptr,
ColumnNameList  target_columns = ColumnNameList() 
)
inline

Definition at line 1274 of file RelAlgDagBuilder.h.

References agg_exprs_, and CHECK_EQ.

1286  : ModifyManipulationTarget(update_disguised_as_select,
1287  delete_disguised_as_select,
1288  varlen_update_required,
1289  manipulation_target_table,
1290  target_columns)
1291  , filter_expr_(std::move(filter_expr))
1292  , groupby_count_(groupby_count)
1293  , fields_(fields)
1294  , is_agg_(is_agg)
1295  , scalar_sources_(std::move(scalar_sources))
1296  , target_exprs_(target_exprs)
1297  , hint_applied_(false)
1298  , hints_(std::make_unique<Hints>()) {
1299  CHECK_EQ(fields.size(), target_exprs.size());
1300  for (auto agg_expr : agg_exprs) {
1301  agg_exprs_.emplace_back(agg_expr);
1302  }
1303  }
bool is_agg(const Analyzer::Expr *expr)
#define CHECK_EQ(x, y)
Definition: Logger.h:205
const std::vector< std::string > fields_
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_
const size_t groupby_count_
std::unique_ptr< Hints > hints_
const std::vector< const Rex * > target_exprs_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::unique_ptr< const RexScalar > filter_expr_
ModifyManipulationTarget(bool const update_via_select=false, bool const delete_via_select=false, bool const varlen_update_required=false, TableDescriptor const *table_descriptor=nullptr, ColumnNameList target_columns=ColumnNameList())
const bool is_agg_
RelCompound::RelCompound ( RelCompound const &  rhs)

Definition at line 442 of file RelAlgDagBuilder.cpp.

References addHint(), filter_expr_, hint_applied_, hints_, and RexVisitorBase< T >::visit().

443  : RelAlgNode(rhs)
445  , groupby_count_(rhs.groupby_count_)
446  , agg_exprs_(copyAggExprs(rhs.agg_exprs_))
447  , fields_(rhs.fields_)
448  , is_agg_(rhs.is_agg_)
449  , scalar_sources_(copyRexScalars(rhs.scalar_sources_))
452  rhs.agg_exprs_,
453  rhs.scalar_sources_,
454  rhs.target_exprs_))
455  , hint_applied_(false)
456  , hints_(std::make_unique<Hints>()) {
457  RexDeepCopyVisitor copier;
458  filter_expr_ = rhs.filter_expr_ ? copier.visit(rhs.filter_expr_.get()) : nullptr;
459  if (rhs.hint_applied_) {
460  for (auto const& kv : *rhs.hints_) {
461  addHint(kv.second);
462  }
463  }
464 }
std::vector< const Rex * > remapTargetPointers(std::vector< std::unique_ptr< const RexAgg >> const &agg_exprs_new, std::vector< std::unique_ptr< const RexScalar >> const &scalar_sources_new, std::vector< std::unique_ptr< const RexAgg >> const &agg_exprs_old, std::vector< std::unique_ptr< const RexScalar >> const &scalar_sources_old, std::vector< const Rex * > const &target_exprs_old)
RelAlgNode(RelAlgInputs inputs={})
const std::vector< std::string > fields_
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_
void addHint(const HintExplained &hint_explained)
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
const size_t groupby_count_
std::vector< std::unique_ptr< const RexAgg > > copyAggExprs(std::vector< std::unique_ptr< const RexAgg >> const &agg_exprs)
std::unique_ptr< Hints > hints_
const std::vector< const Rex * > target_exprs_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::unique_ptr< const RexScalar > filter_expr_
ModifyManipulationTarget(bool const update_via_select=false, bool const delete_via_select=false, bool const varlen_update_required=false, TableDescriptor const *table_descriptor=nullptr, ColumnNameList target_columns=ColumnNameList())
std::vector< std::unique_ptr< const RexScalar > > copyRexScalars(std::vector< std::unique_ptr< const RexScalar >> const &scalar_sources)
const bool is_agg_

+ Here is the call graph for this function:

Member Function Documentation

void RelCompound::addHint ( const HintExplained hint_explained)
inline

Definition at line 1345 of file RelAlgDagBuilder.h.

References HintExplained::getHintName(), hint_applied_, and hints_.

Referenced by RelCompound().

1345  {
1346  if (!hint_applied_) {
1347  hint_applied_ = true;
1348  }
1349  hints_->emplace(hint_explained.getHintName(), hint_explained);
1350  }
const std::string & getHintName() const
std::unique_ptr< Hints > hints_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements RelAlgNode.

Definition at line 1341 of file RelAlgDagBuilder.h.

1341  {
1342  return std::make_shared<RelCompound>(*this);
1343  }
const std::string RelCompound::getFieldName ( const size_t  i) const
inline

Definition at line 1322 of file RelAlgDagBuilder.h.

References fields_.

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

Definition at line 1320 of file RelAlgDagBuilder.h.

References fields_.

1320 { return fields_; }
const std::vector< std::string > fields_
const RexScalar* RelCompound::getFilterExpr ( ) const
inline

Definition at line 1312 of file RelAlgDagBuilder.h.

References filter_expr_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), anonymous_namespace{RelAlgExecutor.cpp}::translate_quals(), RelRexDagVisitor::visit(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitCompound().

1312 { return filter_expr_.get(); }
std::unique_ptr< const RexScalar > filter_expr_

+ Here is the caller graph for this function:

const size_t RelCompound::getGroupByCount ( ) const
inline

Definition at line 1335 of file RelAlgDagBuilder.h.

References groupby_count_.

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

1335 { return groupby_count_; }
const size_t groupby_count_

+ Here is the caller graph for this function:

const HintExplained& RelCompound::getHintInfo ( const std::string &  hint_name) const
inline

Definition at line 1359 of file RelAlgDagBuilder.h.

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

1359  {
1361  CHECK(!hints_->empty());
1362  CHECK(hasHintEnabled(hint_name));
1363  return hints_->at(hint_name);
1364  }
const bool hasHintEnabled(const std::string &candidate_hint_name) const
std::unique_ptr< Hints > hints_
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

const RexScalar* RelCompound::getScalarSource ( const size_t  i) const
inline

Definition at line 1326 of file RelAlgDagBuilder.h.

References scalar_sources_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), anonymous_namespace{RelAlgExecutor.cpp}::scalar_at(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitCompound().

1326  {
1327  return scalar_sources_[i].get();
1328  }
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_

+ Here is the caller graph for this function:

const size_t RelCompound::getScalarSourcesSize ( ) const
inline

Definition at line 1324 of file RelAlgDagBuilder.h.

References scalar_sources_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_scalar_sources_size(), anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitCompound().

1324 { return scalar_sources_.size(); }
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_

+ Here is the caller graph for this function:

const Rex* RelCompound::getTargetExpr ( const size_t  i) const
inline

Definition at line 1318 of file RelAlgDagBuilder.h.

References target_exprs_.

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

1318 { return target_exprs_[i]; }
const std::vector< const Rex * > target_exprs_

+ Here is the caller graph for this function:

const bool RelCompound::hasHintEnabled ( const std::string &  candidate_hint_name) const
inline

Definition at line 1352 of file RelAlgDagBuilder.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1352  {
1353  if (hint_applied_ && !hints_->empty()) {
1354  return hints_->find(candidate_hint_name) != hints_->end();
1355  }
1356  return false;
1357  }
std::unique_ptr< Hints > hints_

+ Here is the caller graph for this function:

bool RelCompound::isAggregate ( ) const
inline

Definition at line 1337 of file RelAlgDagBuilder.h.

References is_agg_.

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

1337 { return is_agg_; }
const bool is_agg_

+ Here is the caller graph for this function:

void RelCompound::replaceInput ( std::shared_ptr< const RelAlgNode old_input,
std::shared_ptr< const RelAlgNode input 
)
overridevirtual

Reimplemented from RelAlgNode.

Definition at line 325 of file RelAlgDagBuilder.cpp.

References filter_expr_, RelAlgNode::replaceInput(), and scalar_sources_.

326  {
327  RelAlgNode::replaceInput(old_input, input);
328  RexRebindInputsVisitor rebind_inputs(old_input.get(), input.get());
329  for (const auto& scalar_source : scalar_sources_) {
330  rebind_inputs.visit(scalar_source.get());
331  }
332  if (filter_expr_) {
333  rebind_inputs.visit(filter_expr_.get());
334  }
335 }
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_
virtual void replaceInput(std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)
std::unique_ptr< const RexScalar > filter_expr_

+ Here is the call graph for this function:

void RelCompound::setFilterExpr ( std::unique_ptr< const RexScalar > &  new_expr)
inline

Definition at line 1314 of file RelAlgDagBuilder.h.

References filter_expr_.

1314  {
1315  filter_expr_ = std::move(new_expr);
1316  }
std::unique_ptr< const RexScalar > filter_expr_
void RelCompound::setScalarSources ( std::vector< std::unique_ptr< const RexScalar >> &  new_sources)
inline

Definition at line 1330 of file RelAlgDagBuilder.h.

References CHECK_EQ, and scalar_sources_.

1330  {
1331  CHECK_EQ(new_sources.size(), scalar_sources_.size());
1332  scalar_sources_ = std::move(new_sources);
1333  }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_
size_t RelCompound::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1310 of file RelAlgDagBuilder.h.

References target_exprs_.

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

1310 { return target_exprs_.size(); }
const std::vector< const Rex * > target_exprs_

+ Here is the caller graph for this function:

std::string RelCompound::toString ( ) const
overridevirtual

Implements RelAlgNode.

Definition at line 2700 of file RelAlgDagBuilder.cpp.

References agg_exprs_, cat(), fields_, filter_expr_, groupby_count_, is_agg_, scalar_sources_, target_exprs_, and to_string().

2700  {
2701  return cat(::typeName(this),
2702  "(",
2703  (filter_expr_ ? filter_expr_->toString() : "null"),
2704  ", target_exprs=",
2706  ", ",
2708  ", agg_exps=",
2710  ", fields=",
2712  ", scalar_sources=",
2714  ", is_agg=",
2716  ")");
2717 }
std::string cat(Ts &&...args)
const std::vector< std::string > fields_
std::string toString() const override
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_
std::string to_string(char const *&&v)
const size_t groupby_count_
const std::vector< const Rex * > target_exprs_
std::vector< std::unique_ptr< const RexAgg > > agg_exprs_
std::unique_ptr< const RexScalar > filter_expr_
const bool is_agg_

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 1369 of file RelAlgDagBuilder.h.

Referenced by RelCompound(), and toString().

const std::vector<std::string> RelCompound::fields_
private

Definition at line 1370 of file RelAlgDagBuilder.h.

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

std::unique_ptr<const RexScalar> RelCompound::filter_expr_
private
const size_t RelCompound::groupby_count_
private

Definition at line 1368 of file RelAlgDagBuilder.h.

Referenced by getGroupByCount(), and toString().

bool RelCompound::hint_applied_
private

Definition at line 1376 of file RelAlgDagBuilder.h.

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

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

Definition at line 1377 of file RelAlgDagBuilder.h.

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

const bool RelCompound::is_agg_
private

Definition at line 1371 of file RelAlgDagBuilder.h.

Referenced by isAggregate(), and toString().

std::vector<std::unique_ptr<const RexScalar> > RelCompound::scalar_sources_
private
const std::vector<const Rex*> RelCompound::target_exprs_
private

Definition at line 1375 of file RelAlgDagBuilder.h.

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


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