OmniSciDB  ba1bac9284
 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 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
 
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 constgetModifiedTableDescriptor () 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 constgetTargetColumns () 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 1209 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 1214 of file RelAlgDagBuilder.h.

References agg_exprs_, and CHECK_EQ.

1226  : ModifyManipulationTarget(update_disguised_as_select,
1227  delete_disguised_as_select,
1228  varlen_update_required,
1229  manipulation_target_table,
1230  target_columns)
1231  , filter_expr_(std::move(filter_expr))
1232  , groupby_count_(groupby_count)
1233  , fields_(fields)
1234  , is_agg_(is_agg)
1235  , scalar_sources_(std::move(scalar_sources))
1236  , target_exprs_(target_exprs)
1237  , hint_applied_(false)
1238  , hints_(std::make_unique<Hints>()) {
1239  CHECK_EQ(fields.size(), target_exprs.size());
1240  for (auto agg_expr : agg_exprs) {
1241  agg_exprs_.emplace_back(agg_expr);
1242  }
1243  }
bool is_agg(const Analyzer::Expr *expr)
#define CHECK_EQ(x, y)
Definition: Logger.h:214
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={})
void addHint(const ExplainedQueryHint &hint_explained)
const std::vector< std::string > fields_
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_
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 ExplainedQueryHint hint_explained)
inline

Definition at line 1285 of file RelAlgDagBuilder.h.

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

Referenced by RelCompound().

1285  {
1286  if (!hint_applied_) {
1287  hint_applied_ = true;
1288  }
1289  hints_->emplace(hint_explained.getHint(), hint_explained);
1290  }
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> RelCompound::deepCopy ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1281 of file RelAlgDagBuilder.h.

1281  {
1282  return std::make_shared<RelCompound>(*this);
1283  }
Hints* RelCompound::getDeliveredHints ( )
inline

Definition at line 1308 of file RelAlgDagBuilder.h.

References hints_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 1262 of file RelAlgDagBuilder.h.

References fields_, and i.

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

Definition at line 1260 of file RelAlgDagBuilder.h.

References fields_.

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

Definition at line 1252 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().

1252 { 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 1275 of file RelAlgDagBuilder.h.

References groupby_count_.

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

1275 { return groupby_count_; }
const size_t groupby_count_

+ Here is the caller graph for this function:

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

Definition at line 1299 of file RelAlgDagBuilder.h.

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

1299  {
1301  CHECK(!hints_->empty());
1302  CHECK(hasHintEnabled(hint));
1303  return hints_->at(hint);
1304  }
std::unique_ptr< Hints > hints_
#define CHECK(condition)
Definition: Logger.h:206
const bool hasHintEnabled(QueryHint candidate_hint) const

+ Here is the call graph for this function:

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

Definition at line 1266 of file RelAlgDagBuilder.h.

References i, and scalar_sources_.

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

1266  {
1267  return scalar_sources_[i].get();
1268  }
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 1264 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().

1264 { 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 1258 of file RelAlgDagBuilder.h.

References i, and target_exprs_.

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

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

+ Here is the caller graph for this function:

bool RelCompound::hasDeliveredHint ( )
inline

Definition at line 1306 of file RelAlgDagBuilder.h.

References hints_.

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

Definition at line 1292 of file RelAlgDagBuilder.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1292  {
1293  if (hint_applied_ && !hints_->empty()) {
1294  return hints_->find(candidate_hint) != hints_->end();
1295  }
1296  return false;
1297  }
std::unique_ptr< Hints > hints_

+ Here is the caller graph for this function:

bool RelCompound::isAggregate ( ) const
inline

Definition at line 1277 of file RelAlgDagBuilder.h.

References is_agg_.

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

1277 { 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 1254 of file RelAlgDagBuilder.h.

References filter_expr_.

1254  {
1255  filter_expr_ = std::move(new_expr);
1256  }
std::unique_ptr< const RexScalar > filter_expr_
void RelCompound::setScalarSources ( std::vector< std::unique_ptr< const RexScalar >> &  new_sources)
inline

Definition at line 1270 of file RelAlgDagBuilder.h.

References CHECK_EQ, and scalar_sources_.

1270  {
1271  CHECK_EQ(new_sources.size(), scalar_sources_.size());
1272  scalar_sources_ = std::move(new_sources);
1273  }
#define CHECK_EQ(x, y)
Definition: Logger.h:214
std::vector< std::unique_ptr< const RexScalar > > scalar_sources_
size_t RelCompound::size ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1250 of file RelAlgDagBuilder.h.

References target_exprs_.

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

1250 { 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 2732 of file RelAlgDagBuilder.cpp.

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

2732  {
2733  return cat(::typeName(this),
2734  "(",
2735  (filter_expr_ ? filter_expr_->toString() : "null"),
2736  ", target_exprs=",
2738  ", ",
2740  ", agg_exps=",
2742  ", fields=",
2744  ", scalar_sources=",
2746  ", is_agg=",
2748  ")");
2749 }
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_
std::string typeName(const T *v)
Definition: toString.h:82
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 1313 of file RelAlgDagBuilder.h.

Referenced by RelCompound(), and toString().

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

Definition at line 1314 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 1312 of file RelAlgDagBuilder.h.

Referenced by getGroupByCount(), and toString().

bool RelCompound::hint_applied_
private

Definition at line 1320 of file RelAlgDagBuilder.h.

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

std::unique_ptr<Hints> RelCompound::hints_
private
const bool RelCompound::is_agg_
private

Definition at line 1315 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 1319 of file RelAlgDagBuilder.h.

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


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