OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelProject Class Reference

#include <RelAlgDag.h>

+ Inheritance diagram for RelProject:
+ Collaboration diagram for RelProject:

Public Types

using ConstRexScalarPtr = std::unique_ptr< const RexScalar >
 
using ConstRexScalarPtrVector = std::vector< ConstRexScalarPtr >
 

Public Member Functions

 RelProject (const TableDescriptor *td)
 
 RelProject (std::vector< std::unique_ptr< const RexScalar >> &scalar_exprs, const std::vector< std::string > &fields, std::shared_ptr< const RelAlgNode > input)
 
 RelProject (RelProject const &)
 
void setExpressions (std::vector< std::unique_ptr< const RexScalar >> &exprs) const
 
bool isSimple () const
 
bool isIdentity () const
 
bool isRenaming () const
 
size_t size () const override
 
void propagateModifyManipulationTarget (std::shared_ptr< RelProject > new_project_node) const
 
void resetModifyManipulationTarget () const
 
bool hasPushedDownWindowExpr () const
 
void setPushedDownWindowExpr ()
 
const RexScalargetProjectAt (const size_t idx) const
 
const RexScalargetProjectAtAndRelease (const size_t idx) const
 
std::vector< std::unique_ptr
< const RexScalar > > 
getExpressionsAndRelease ()
 
const std::vector< std::string > & getFields () const
 
void setFields (std::vector< std::string > &&fields)
 
const std::string getFieldName (const size_t i) const
 
void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input) override
 
void replaceInput (std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input, std::optional< std::unordered_map< unsigned, unsigned >> old_to_new_index_map)
 
void appendInput (std::string new_field_name, std::unique_ptr< const RexScalar > new_input)
 
std::string toString (RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
 
size_t toHash () const override
 
std::shared_ptr< RelAlgNodedeepCopy () const override
 
bool hasWindowFunctionExpr () const
 
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 RaExecutionDesc *context_data) const
 
void setOutputMetainfo (std::vector< TargetMetaInfo > targets_metainfo) const
 
void setQueryPlanDag (const std::string &extracted_query_plan_dag) const
 
std::string getQueryPlanDag () const
 
size_t getQueryPlanDagHash () const
 
const std::vector
< TargetMetaInfo > & 
getOutputMetainfo () const
 
unsigned getId () const
 
void setIdInPlanTree (size_t id) const
 
std::optional< size_t > getIdInPlanTree () const
 
bool hasContextData () const
 
const RaExecutionDescgetContextData () 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
 
void setRelNodeDagId (const size_t id) const
 
size_t getRelNodeDagId () 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 (bool required) const
 
void setDeleteViaSelectFlag (bool required) const
 
void setVarlenUpdateRequired (bool required) const
 
void forceRowwiseOutput () const
 
TableDescriptor const * getModifiedTableDescriptor () const
 
TableDescriptor const * getTableDescriptor () const
 
void setModifiedTableDescriptor (TableDescriptor const *td) const
 
auto const isUpdateViaSelect () const
 
auto const isDeleteViaSelect () const
 
auto const isVarlenUpdateRequired () const
 
auto const isProjectForUpdate () const
 
auto const isRowwiseOutputForced () const
 
void setTargetColumns (ColumnNameList const &target_columns) const
 
ColumnNameList const & getTargetColumns () const
 
void invalidateTargetColumns () const
 
template<typename VALIDATION_FUNCTOR >
bool validateTargetColumns (VALIDATION_FUNCTOR validator) const
 

Private Member Functions

template<typename EXPR_VISITOR_FUNCTOR >
void visitScalarExprs (EXPR_VISITOR_FUNCTOR visitor_functor) const
 
void injectOffsetInFragmentExpr () const
 

Private Attributes

std::vector< std::unique_ptr
< const RexScalar > > 
scalar_exprs_
 
std::vector< std::string > fields_
 
bool hint_applied_
 
std::unique_ptr< Hintshints_
 
bool has_pushed_down_window_expr_
 

Friends

class RelModify
 
struct RelAlgDagSerializer
 

Additional Inherited Members

- Static Public Member Functions inherited from RelAlgNode
static void resetRelAlgFirstId () noexcept
 
- Protected Attributes inherited from RelAlgNode
RelAlgInputs inputs_
 
unsigned id_
 
std::optional< size_t > id_in_plan_tree_
 
std::optional< size_t > hash_
 

Detailed Description

Definition at line 1109 of file RelAlgDag.h.

Member Typedef Documentation

using RelProject::ConstRexScalarPtr = std::unique_ptr<const RexScalar>

Definition at line 1112 of file RelAlgDag.h.

Definition at line 1113 of file RelAlgDag.h.

Constructor & Destructor Documentation

RelProject::RelProject ( const TableDescriptor td)
inline

Definition at line 1116 of file RelAlgDag.h.

Referenced by toHash().

1117  : ModifyManipulationTarget(false, false, false, td)
1118  , hint_applied_{false}
1119  , has_pushed_down_window_expr_{false} {}
bool has_pushed_down_window_expr_
Definition: RelAlgDag.h:1297
bool hint_applied_
Definition: RelAlgDag.h:1295
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())
Definition: RelAlgDag.h:1049

+ Here is the caller graph for this function:

RelProject::RelProject ( std::vector< std::unique_ptr< const RexScalar >> &  scalar_exprs,
const std::vector< std::string > &  fields,
std::shared_ptr< const RelAlgNode input 
)
inline

Definition at line 1122 of file RelAlgDag.h.

References RelAlgNode::inputs_.

1125  : ModifyManipulationTarget(false, false, false, nullptr)
1126  , scalar_exprs_(std::move(scalar_exprs))
1127  , fields_(fields)
1128  , hint_applied_(false)
1129  , hints_(std::make_unique<Hints>())
1130  , has_pushed_down_window_expr_(false) {
1131  inputs_.push_back(input);
1132  }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
bool has_pushed_down_window_expr_
Definition: RelAlgDag.h:1297
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1296
bool hint_applied_
Definition: RelAlgDag.h:1295
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())
Definition: RelAlgDag.h:1049
RelAlgInputs inputs_
Definition: RelAlgDag.h:952
RelProject::RelProject ( RelProject const &  rhs)

Definition at line 555 of file RelAlgDag.cpp.

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

556  : RelAlgNode(rhs)
558  , fields_(rhs.fields_)
559  , hint_applied_(false)
560  , hints_(std::make_unique<Hints>())
561  , has_pushed_down_window_expr_(rhs.has_pushed_down_window_expr_) {
562  RexDeepCopyVisitor copier;
563  for (auto const& expr : rhs.scalar_exprs_) {
564  scalar_exprs_.push_back(copier.visit(expr.get()));
565  }
566  if (rhs.hint_applied_) {
567  for (auto const& kv : *rhs.hints_) {
568  addHint(kv.second);
569  }
570  }
571 }
RelAlgNode(RelAlgInputs inputs={})
Definition: RelAlgDag.h:840
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
bool has_pushed_down_window_expr_
Definition: RelAlgDag.h:1297
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
void addHint(const ExplainedQueryHint &hint_explained)
Definition: RelAlgDag.h:1251
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1296
bool hint_applied_
Definition: RelAlgDag.h:1295
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())
Definition: RelAlgDag.h:1049

+ Here is the call graph for this function:

Member Function Documentation

void RelProject::addHint ( const ExplainedQueryHint hint_explained)
inline

Definition at line 1251 of file RelAlgDag.h.

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

Referenced by RelProject().

1251  {
1252  if (!hint_applied_) {
1253  hint_applied_ = true;
1254  }
1255  hints_->emplace(hint_explained.getHint(), hint_explained);
1256  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1296
bool hint_applied_
Definition: RelAlgDag.h:1295
const QueryHint getHint() const
Definition: QueryHint.h:154

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RelProject::appendInput ( std::string  new_field_name,
std::unique_ptr< const RexScalar new_input 
)

Definition at line 364 of file RelAlgDag.cpp.

References fields_, and scalar_exprs_.

365  {
366  fields_.emplace_back(std::move(new_field_name));
367  scalar_exprs_.emplace_back(std::move(new_input));
368 }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
std::shared_ptr<RelAlgNode> RelProject::deepCopy ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1238 of file RelAlgDag.h.

References has_pushed_down_window_expr_, ModifyManipulationTarget::isProjectForUpdate(), and propagateModifyManipulationTarget().

1238  {
1239  auto copied_project_node = std::make_shared<RelProject>(*this);
1240  if (isProjectForUpdate()) {
1241  propagateModifyManipulationTarget(copied_project_node);
1242  }
1244  copied_project_node->setPushedDownWindowExpr();
1245  }
1246  return copied_project_node;
1247  }
auto const isProjectForUpdate() const
Definition: RelAlgDag.h:1076
bool has_pushed_down_window_expr_
Definition: RelAlgDag.h:1297
void propagateModifyManipulationTarget(std::shared_ptr< RelProject > new_project_node) const
Definition: RelAlgDag.h:1158

+ Here is the call graph for this function:

Hints* RelProject::getDeliveredHints ( )
inline

Definition at line 1274 of file RelAlgDag.h.

References hints_.

Referenced by anonymous_namespace{RelAlgDag.cpp}::handle_query_hint().

1274 { return hints_.get(); }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1296

+ Here is the caller graph for this function:

std::vector<std::unique_ptr<const RexScalar> > RelProject::getExpressionsAndRelease ( )
inline

Definition at line 1196 of file RelAlgDag.h.

References scalar_exprs_.

1196  {
1197  return std::move(scalar_exprs_);
1198  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
const std::string RelProject::getFieldName ( const size_t  i) const
inline

Definition at line 1203 of file RelAlgDag.h.

References fields_.

1203 { return fields_[i]; }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
const std::vector<std::string>& RelProject::getFields ( ) const
inline

Definition at line 1200 of file RelAlgDag.h.

References fields_.

Referenced by anonymous_namespace{RelAlgDag.cpp}::create_compound().

1200 { return fields_; }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294

+ Here is the caller graph for this function:

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

Definition at line 1265 of file RelAlgDag.h.

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

1265  {
1267  CHECK(!hints_->empty());
1268  CHECK(hasHintEnabled(hint));
1269  return hints_->at(hint);
1270  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1296
bool hint_applied_
Definition: RelAlgDag.h:1295
#define CHECK(condition)
Definition: Logger.h:289
const bool hasHintEnabled(QueryHint candidate_hint) const
Definition: RelAlgDag.h:1258

+ Here is the call graph for this function:

const RexScalar* RelProject::getProjectAt ( const size_t  idx) const
inline

Definition at line 1186 of file RelAlgDag.h.

References CHECK, and scalar_exprs_.

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::get_used_inputs(), anonymous_namespace{RelAlgOptimizer.cpp}::is_identical_copy(), anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::need_pushdown_generic_expr(), anonymous_namespace{RelAlgExecutor.cpp}::scalar_at(), RelRexDagVisitor::visit(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RelAlgPhysicalInputsVisitor::visitProject().

1186  {
1187  CHECK(idx < scalar_exprs_.size());
1188  return scalar_exprs_[idx].get();
1189  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the caller graph for this function:

const RexScalar* RelProject::getProjectAtAndRelease ( const size_t  idx) const
inline

Definition at line 1191 of file RelAlgDag.h.

References CHECK, and scalar_exprs_.

1191  {
1192  CHECK(idx < scalar_exprs_.size());
1193  return scalar_exprs_[idx].release();
1194  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
#define CHECK(condition)
Definition: Logger.h:289
bool RelProject::hasDeliveredHint ( )
inline

Definition at line 1272 of file RelAlgDag.h.

References hints_.

1272 { return !hints_->empty(); }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1296
const bool RelProject::hasHintEnabled ( QueryHint  candidate_hint) const
inline

Definition at line 1258 of file RelAlgDag.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1258  {
1259  if (hint_applied_ && !hints_->empty()) {
1260  return hints_->find(candidate_hint) != hints_->end();
1261  }
1262  return false;
1263  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1296
bool hint_applied_
Definition: RelAlgDag.h:1295

+ Here is the caller graph for this function:

bool RelProject::hasPushedDownWindowExpr ( ) const
inline

Definition at line 1182 of file RelAlgDag.h.

References has_pushed_down_window_expr_.

1182 { return has_pushed_down_window_expr_; }
bool has_pushed_down_window_expr_
Definition: RelAlgDag.h:1297
bool RelProject::hasWindowFunctionExpr ( ) const

Definition at line 2766 of file RelAlgDag.cpp.

References anonymous_namespace{RelAlgDag.cpp}::anonymous_namespace{RelAlgDag.cpp}::is_window_function_operator(), and scalar_exprs_.

Referenced by RelModify::applyUpdateModificationsToInputNode().

2766  {
2767  for (const auto& expr : scalar_exprs_) {
2768  if (is_window_function_operator(expr.get())) {
2769  return true;
2770  }
2771  }
2772  return false;
2773 }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RelProject::injectOffsetInFragmentExpr ( ) const
inlineprivate

Definition at line 1284 of file RelAlgDag.h.

References fields_, kBIGINT, and scalar_exprs_.

1284  {
1286  scalar_exprs_.emplace_back(
1287  std::make_unique<RexFunctionOperator const>(std::string("OFFSET_IN_FRAGMENT"),
1288  transient_vector,
1289  SQLTypeInfo(kBIGINT, false)));
1290  fields_.emplace_back("EXPR$DELETE_OFFSET_IN_FRAGMENT");
1291  }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
std::vector< ConstRexScalarPtr > ConstRexScalarPtrVector
Definition: RelAlgDag.h:484
bool RelProject::isIdentity ( ) const

Definition at line 439 of file RelAlgDag.cpp.

References CHECK, CHECK_EQ, get_node_output(), RelAlgNode::getInput(), RelAlgNode::inputCount(), isSimple(), and scalar_exprs_.

439  {
440  if (!isSimple()) {
441  return false;
442  }
443  CHECK_EQ(size_t(1), inputCount());
444  const auto source = getInput(0);
445  if (dynamic_cast<const RelJoin*>(source)) {
446  return false;
447  }
448  const auto source_shape = get_node_output(source);
449  if (source_shape.size() != scalar_exprs_.size()) {
450  return false;
451  }
452  for (size_t i = 0; i < scalar_exprs_.size(); ++i) {
453  const auto& scalar_expr = scalar_exprs_[i];
454  const auto input = dynamic_cast<const RexInput*>(scalar_expr.get());
455  CHECK(input);
456  CHECK_EQ(source, input->getSourceNode());
457  // We should add the additional check that input->getIndex() !=
458  // source_shape[i].getIndex(), but Calcite doesn't generate the right
459  // Sort-Project-Sort sequence when joins are involved.
460  if (input->getSourceNode() != source_shape[i].getSourceNode()) {
461  return false;
462  }
463  }
464  return true;
465 }
#define CHECK_EQ(x, y)
Definition: Logger.h:297
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
const RelAlgNode * getInput(const size_t idx) const
Definition: RelAlgDag.h:892
bool isSimple() const
Definition: RelAlgDag.h:1143
#define CHECK(condition)
Definition: Logger.h:289
const size_t inputCount() const
Definition: RelAlgDag.h:890
RANodeOutput get_node_output(const RelAlgNode *ra_node)
Definition: RelAlgDag.cpp:370

+ Here is the call graph for this function:

bool RelProject::isRenaming ( ) const

Definition at line 512 of file RelAlgDag.cpp.

References CHECK, CHECK_EQ, fields_, anonymous_namespace{RelAlgDag.cpp}::isRenamedInput(), isSimple(), and scalar_exprs_.

512  {
513  if (!isSimple()) {
514  return false;
515  }
516  CHECK_EQ(scalar_exprs_.size(), fields_.size());
517  for (size_t i = 0; i < fields_.size(); ++i) {
518  auto rex_in = dynamic_cast<const RexInput*>(scalar_exprs_[i].get());
519  CHECK(rex_in);
520  if (isRenamedInput(rex_in->getSourceNode(), rex_in->getIndex(), fields_[i])) {
521  return true;
522  }
523  }
524  return false;
525 }
#define CHECK_EQ(x, y)
Definition: Logger.h:297
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
bool isRenamedInput(const RelAlgNode *node, const size_t index, const std::string &new_name)
Definition: RelAlgDag.cpp:469
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
bool isSimple() const
Definition: RelAlgDag.h:1143
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the call graph for this function:

bool RelProject::isSimple ( ) const
inline

Definition at line 1143 of file RelAlgDag.h.

References scalar_exprs_.

Referenced by RelAlgExecutor::executeProject(), isIdentity(), isRenaming(), and anonymous_namespace{RelAlgOptimizer.cpp}::safe_to_redirect().

1143  {
1144  for (const auto& expr : scalar_exprs_) {
1145  if (!dynamic_cast<const RexInput*>(expr.get())) {
1146  return false;
1147  }
1148  }
1149  return true;
1150  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293

+ Here is the caller graph for this function:

void RelProject::propagateModifyManipulationTarget ( std::shared_ptr< RelProject new_project_node) const
inline

Definition at line 1158 of file RelAlgDag.h.

References ModifyManipulationTarget::getModifiedTableDescriptor(), ModifyManipulationTarget::getTargetColumns(), ModifyManipulationTarget::isDeleteViaSelect(), ModifyManipulationTarget::isUpdateViaSelect(), ModifyManipulationTarget::isVarlenUpdateRequired(), and resetModifyManipulationTarget().

Referenced by deepCopy().

1159  {
1160  if (isUpdateViaSelect()) {
1161  new_project_node->setUpdateViaSelectFlag(true);
1162  }
1163  if (isDeleteViaSelect()) {
1164  new_project_node->setDeleteViaSelectFlag(true);
1165  }
1166  if (isVarlenUpdateRequired()) {
1167  new_project_node->setVarlenUpdateRequired(true);
1168  }
1169  new_project_node->setModifiedTableDescriptor(getModifiedTableDescriptor());
1170  new_project_node->setTargetColumns(getTargetColumns());
1172  }
ColumnNameList const & getTargetColumns() const
Definition: RelAlgDag.h:1084
void resetModifyManipulationTarget() const
Definition: RelAlgDag.h:1174
auto const isDeleteViaSelect() const
Definition: RelAlgDag.h:1074
auto const isUpdateViaSelect() const
Definition: RelAlgDag.h:1073
auto const isVarlenUpdateRequired() const
Definition: RelAlgDag.h:1075
TableDescriptor const * getModifiedTableDescriptor() const
Definition: RelAlgDag.h:1067

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RelProject::replaceInput ( std::shared_ptr< const RelAlgNode old_input,
std::shared_ptr< const RelAlgNode input 
)
inlineoverridevirtual

Reimplemented from RelAlgNode.

Definition at line 1205 of file RelAlgDag.h.

1206  {
1207  replaceInput(old_input, input, std::nullopt);
1208  }
void replaceInput(std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input) override
Definition: RelAlgDag.h:1205
void RelProject::replaceInput ( std::shared_ptr< const RelAlgNode old_input,
std::shared_ptr< const RelAlgNode input,
std::optional< std::unordered_map< unsigned, unsigned >>  old_to_new_index_map 
)

Definition at line 345 of file RelAlgDag.cpp.

References CHECK, RelAlgNode::replaceInput(), and scalar_exprs_.

348  {
349  RelAlgNode::replaceInput(old_input, input);
350  std::unique_ptr<RexRebindInputsVisitor> rebind_inputs;
351  if (old_to_new_index_map) {
352  rebind_inputs = std::make_unique<RexRebindReindexInputsVisitor>(
353  old_input.get(), input.get(), *old_to_new_index_map);
354  } else {
355  rebind_inputs =
356  std::make_unique<RexRebindInputsVisitor>(old_input.get(), input.get());
357  }
358  CHECK(rebind_inputs);
359  for (const auto& scalar_expr : scalar_exprs_) {
360  rebind_inputs->visit(scalar_expr.get());
361  }
362 }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
virtual void replaceInput(std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input)
Definition: RelAlgDag.h:915
#define CHECK(condition)
Definition: Logger.h:289

+ Here is the call graph for this function:

void RelProject::resetModifyManipulationTarget ( ) const
inline

Definition at line 1174 of file RelAlgDag.h.

References ModifyManipulationTarget::invalidateTargetColumns(), ModifyManipulationTarget::setDeleteViaSelectFlag(), ModifyManipulationTarget::setModifiedTableDescriptor(), ModifyManipulationTarget::setUpdateViaSelectFlag(), and ModifyManipulationTarget::setVarlenUpdateRequired().

Referenced by propagateModifyManipulationTarget().

1174  {
1175  setModifiedTableDescriptor(nullptr);
1176  setUpdateViaSelectFlag(false);
1177  setDeleteViaSelectFlag(false);
1178  setVarlenUpdateRequired(false);
1180  }
void setVarlenUpdateRequired(bool required) const
Definition: RelAlgDag.h:1062
void invalidateTargetColumns() const
Definition: RelAlgDag.h:1086
void setDeleteViaSelectFlag(bool required) const
Definition: RelAlgDag.h:1061
void setUpdateViaSelectFlag(bool required) const
Definition: RelAlgDag.h:1060
void setModifiedTableDescriptor(TableDescriptor const *td) const
Definition: RelAlgDag.h:1069

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RelProject::setExpressions ( std::vector< std::unique_ptr< const RexScalar >> &  exprs) const
inline

Definition at line 1136 of file RelAlgDag.h.

References scalar_exprs_.

1136  {
1137  scalar_exprs_ = std::move(exprs);
1138  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
void RelProject::setFields ( std::vector< std::string > &&  fields)
inline

Definition at line 1201 of file RelAlgDag.h.

References fields_.

1201 { fields_ = std::move(fields); }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
void RelProject::setPushedDownWindowExpr ( )
inline

Definition at line 1184 of file RelAlgDag.h.

References has_pushed_down_window_expr_.

1184 { has_pushed_down_window_expr_ = true; }
bool has_pushed_down_window_expr_
Definition: RelAlgDag.h:1297
size_t RelProject::size ( ) const
inlineoverridevirtual
size_t RelProject::toHash ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1227 of file RelAlgDag.h.

References fields_, RelAlgNode::hash_, RelProject(), scalar_exprs_, and toString().

1227  {
1228  if (!hash_) {
1229  hash_ = typeid(RelProject).hash_code();
1230  for (auto& target_expr : scalar_exprs_) {
1231  boost::hash_combine(*hash_, target_expr->toHash());
1232  }
1233  boost::hash_combine(*hash_, ::toString(fields_));
1234  }
1235  return *hash_;
1236  }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
std::optional< size_t > hash_
Definition: RelAlgDag.h:955
RelProject(const TableDescriptor *td)
Definition: RelAlgDag.h:1116
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:1218

+ Here is the call graph for this function:

std::string RelProject::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1218 of file RelAlgDag.h.

References cat(), fields_, scalar_exprs_, and typeName().

Referenced by toHash().

1219  {
1220  auto ret = cat(::typeName(this), "(");
1221  for (auto& expr : scalar_exprs_) {
1222  ret += expr->toString(config) + " ";
1223  }
1224  return cat(ret, ", ", ::toString(fields_), ")");
1225  }
std::string cat(Ts &&...args)
std::vector< std::string > fields_
Definition: RelAlgDag.h:1294
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293
std::string typeName(const T *v)
Definition: toString.h:103
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:1218

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename EXPR_VISITOR_FUNCTOR >
void RelProject::visitScalarExprs ( EXPR_VISITOR_FUNCTOR  visitor_functor) const
inlineprivate

Definition at line 1278 of file RelAlgDag.h.

References scalar_exprs_.

Referenced by RelModify::applyUpdateModificationsToInputNode().

1278  {
1279  for (int i = 0; i < static_cast<int>(scalar_exprs_.size()); i++) {
1280  visitor_functor(i);
1281  }
1282  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1293

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend struct RelAlgDagSerializer
friend

Definition at line 1299 of file RelAlgDag.h.

friend class RelModify
friend

Definition at line 1111 of file RelAlgDag.h.

Member Data Documentation

std::vector<std::string> RelProject::fields_
mutableprivate
bool RelProject::has_pushed_down_window_expr_
private

Definition at line 1297 of file RelAlgDag.h.

Referenced by deepCopy(), hasPushedDownWindowExpr(), and setPushedDownWindowExpr().

bool RelProject::hint_applied_
private

Definition at line 1295 of file RelAlgDag.h.

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

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

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