OmniSciDB  a5dc49c757
 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, const Catalog_Namespace::Catalog *catalog)
 
 scalar_exprs_ (std::move(scalar_exprs))
 
 fields_ (fields)
 
 hint_applied_ (false)
 
 hints_ (std::make_unique< Hints >())
 
 has_pushed_down_window_expr_ (false)
 
 RelProject (RelProject const &)
 
virtual void acceptChildren (Visitor &v) const override
 
virtual void accept (Visitor &v, std::string name) const override
 
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 idx) 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
 
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 ()
 
virtual size_t toHash () const override
 
- 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
 
bool hasContextData () const
 
const RaExecutionDescgetContextData () const
 
const size_t inputCount () const
 
const RelAlgNodegetInput (const size_t idx) const
 
const std::vector< RelAlgNode
const * > 
getInputs () 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 RelAlgDagNode
 RelAlgDagNode ()
 
virtual size_t getStepNumber () const
 
virtual void setStepNumber (size_t step) const
 
std::optional< size_t > getIdInPlanTree () const
 
void setIdInPlanTree (size_t id) 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(), const Catalog_Namespace::Catalog *catalog=nullptr)
 
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
 
const Catalog_Namespace::CataloggetModifiedTableCatalog () const
 
void setModifiedTableCatalog (const Catalog_Namespace::Catalog *catalog) 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
 

Public Attributes

 catalog
 
 hint_applied_ {false}
 
 has_pushed_down_window_expr_
 

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
 
std::size_t hash_value (RelProject const &)
 

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 > hash_
 
- Protected Attributes inherited from RelAlgDagNode
size_t step_ {0}
 
std::optional< size_t > id_in_plan_tree_
 

Detailed Description

Definition at line 1254 of file RelAlgDag.h.

Member Typedef Documentation

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

Definition at line 1257 of file RelAlgDag.h.

Definition at line 1258 of file RelAlgDag.h.

Constructor & Destructor Documentation

RelProject::RelProject ( const TableDescriptor td,
const Catalog_Namespace::Catalog catalog 
)
inline

Definition at line 1261 of file RelAlgDag.h.

1262  : ModifyManipulationTarget(false, false, false, td, {}, catalog)
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 Catalog_Namespace::Catalog *catalog=nullptr)
Definition: RelAlgDag.h:1185
RelProject::RelProject ( RelProject const &  rhs)

Definition at line 556 of file RelAlgDag.cpp.

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

557  : RelAlgNode(rhs)
559  , fields_(rhs.fields_)
560  , hint_applied_(false)
561  , hints_(std::make_unique<Hints>())
562  , has_pushed_down_window_expr_(rhs.has_pushed_down_window_expr_) {
563  RexDeepCopyVisitor copier;
564  for (auto const& expr : rhs.scalar_exprs_) {
565  scalar_exprs_.push_back(copier.visit(expr.get()));
566  }
567  if (rhs.hint_applied_) {
568  for (auto const& kv : *rhs.hints_) {
569  addHint(kv.second);
570  }
571  }
572 }
RelAlgNode(RelAlgInputs inputs={})
Definition: RelAlgDag.h:830
std::vector< std::string > fields_
Definition: RelAlgDag.h:1460
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
void addHint(const ExplainedQueryHint &hint_explained)
Definition: RelAlgDag.h:1413
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1462
has_pushed_down_window_expr_
Definition: RelAlgDag.h:1264
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 Catalog_Namespace::Catalog *catalog=nullptr)
Definition: RelAlgDag.h:1185

+ Here is the call graph for this function:

Member Function Documentation

virtual void RelProject::accept ( Visitor v,
std::string  name 
) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1294 of file RelAlgDag.h.

References acceptChildren(), and RelAlgDagNode::Visitor::visit().

Referenced by TableFunctionsFactory_node.PrintNode::__str__().

1294  {
1295  if (v.visit(this, std::move(name))) {
1296  acceptChildren(v);
1297  }
1298  }
virtual void acceptChildren(Visitor &v) const override
Definition: RelAlgDag.h:1282
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void RelProject::acceptChildren ( Visitor v) const
inlineoverridevirtual

Implements RelAlgDagNode.

Definition at line 1282 of file RelAlgDag.h.

References RelAlgDagNode::accept(), getFieldName(), RelAlgNode::getInputs(), getProjectAt(), anonymous_namespace{Utm.h}::n, and size().

Referenced by accept().

1282  {
1283  for (size_t i = 0; i < size(); ++i) {
1284  if (getProjectAt(i)) {
1285  getProjectAt(i)->accept(v, "\"" + getFieldName(i) + "\"");
1286  }
1287  }
1288  for (auto& n : getInputs()) {
1289  if (n) {
1290  n->accept(v, "input");
1291  }
1292  }
1293  }
size_t size() const override
Definition: RelAlgDag.h:1320
const RexScalar * getProjectAt(const size_t idx) const
Definition: RelAlgDag.h:1352
virtual void accept(Visitor &v, std::string name) const =0
const std::vector< RelAlgNode const * > getInputs() const
Definition: RelAlgDag.h:882
const std::string getFieldName(const size_t idx) const
Definition: RelAlgDag.h:1369
constexpr double n
Definition: Utm.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RelProject::addHint ( const ExplainedQueryHint hint_explained)
inline

Definition at line 1413 of file RelAlgDag.h.

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

Referenced by RelProject().

1413  {
1414  if (!hint_applied_) {
1415  hint_applied_ = true;
1416  }
1417  hints_->emplace(hint_explained.getHint(), hint_explained);
1418  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1462
const QueryHint getHint() const
Definition: QueryHint.h:167

+ 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 365 of file RelAlgDag.cpp.

References fields_, and scalar_exprs_.

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

Implements RelAlgNode.

Definition at line 1400 of file RelAlgDag.h.

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

1400  {
1401  auto copied_project_node = std::make_shared<RelProject>(*this);
1402  if (isProjectForUpdate()) {
1403  propagateModifyManipulationTarget(copied_project_node);
1404  }
1406  copied_project_node->setPushedDownWindowExpr();
1407  }
1408  return copied_project_node;
1409  }
auto const isProjectForUpdate() const
Definition: RelAlgDag.h:1220
void propagateModifyManipulationTarget(std::shared_ptr< RelProject > new_project_node) const
Definition: RelAlgDag.h:1322
has_pushed_down_window_expr_
Definition: RelAlgDag.h:1264

+ Here is the call graph for this function:

RelProject::fields_ ( fields  )
Hints* RelProject::getDeliveredHints ( )
inline

Definition at line 1436 of file RelAlgDag.h.

References hints_.

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

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

+ Here is the caller graph for this function:

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

Definition at line 1362 of file RelAlgDag.h.

References scalar_exprs_.

1362  {
1363  return std::move(scalar_exprs_);
1364  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
const std::string RelProject::getFieldName ( const size_t  idx) const
inline

Definition at line 1369 of file RelAlgDag.h.

References CHECK, and fields_.

Referenced by acceptChildren().

1369  {
1370  CHECK(idx < fields_.size());
1371  return fields_[idx];
1372  }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1460
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

const std::vector<std::string>& RelProject::getFields ( ) const
inline

Definition at line 1366 of file RelAlgDag.h.

References fields_.

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

1366 { return fields_; }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1460

+ Here is the caller graph for this function:

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

Definition at line 1427 of file RelAlgDag.h.

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

1427  {
1429  CHECK(!hints_->empty());
1430  CHECK(hasHintEnabled(hint));
1431  return hints_->at(hint);
1432  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1462
#define CHECK(condition)
Definition: Logger.h:291
const bool hasHintEnabled(QueryHint candidate_hint) const
Definition: RelAlgDag.h:1420

+ Here is the call graph for this function:

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

Definition at line 1352 of file RelAlgDag.h.

References CHECK, and scalar_exprs_.

Referenced by acceptChildren(), 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().

1352  {
1353  CHECK(idx < scalar_exprs_.size());
1354  return scalar_exprs_[idx].get();
1355  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function:

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

Definition at line 1357 of file RelAlgDag.h.

References CHECK, and scalar_exprs_.

1357  {
1358  CHECK(idx < scalar_exprs_.size());
1359  return scalar_exprs_[idx].release();
1360  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
#define CHECK(condition)
Definition: Logger.h:291
RelProject::has_pushed_down_window_expr_ ( false  )
inline

Definition at line 1275 of file RelAlgDag.h.

References CHECK_EQ, fields_, RelAlgNode::inputs_, and scalar_exprs_.

1275  {
1276  CHECK_EQ(scalar_exprs_.size(), fields_.size());
1277  inputs_.push_back(input);
1278  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
std::vector< std::string > fields_
Definition: RelAlgDag.h:1460
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
RelAlgInputs inputs_
Definition: RelAlgDag.h:945
bool RelProject::hasDeliveredHint ( )
inline

Definition at line 1434 of file RelAlgDag.h.

References hints_.

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

Definition at line 1420 of file RelAlgDag.h.

References hint_applied_, and hints_.

Referenced by getHintInfo().

1420  {
1421  if (hint_applied_ && !hints_->empty()) {
1422  return hints_->find(candidate_hint) != hints_->end();
1423  }
1424  return false;
1425  }
std::unique_ptr< Hints > hints_
Definition: RelAlgDag.h:1462

+ Here is the caller graph for this function:

bool RelProject::hasPushedDownWindowExpr ( ) const
inline

Definition at line 1348 of file RelAlgDag.h.

References has_pushed_down_window_expr_.

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

Definition at line 2880 of file RelAlgDag.cpp.

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

2880  {
2881  for (const auto& expr : scalar_exprs_) {
2882  if (is_window_function_operator(expr.get())) {
2883  return true;
2884  }
2885  }
2886  return false;
2887 }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459

+ Here is the call graph for this function:

RelProject::hint_applied_ ( false  )
RelProject::hints_ ( std::make_unique< Hints ())
void RelProject::injectOffsetInFragmentExpr ( ) const
inlineprivate

Definition at line 1450 of file RelAlgDag.h.

References fields_, kBIGINT, and scalar_exprs_.

1450  {
1452  scalar_exprs_.emplace_back(
1453  std::make_unique<RexFunctionOperator const>(std::string("OFFSET_IN_FRAGMENT"),
1454  transient_vector,
1455  SQLTypeInfo(kBIGINT, false)));
1456  fields_.emplace_back("EXPR$DELETE_OFFSET_IN_FRAGMENT");
1457  }
std::vector< std::string > fields_
Definition: RelAlgDag.h:1460
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
std::vector< ConstRexScalarPtr > ConstRexScalarPtrVector
Definition: RelAlgDag.h:477
bool RelProject::isIdentity ( ) const

Definition at line 440 of file RelAlgDag.cpp.

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

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

+ Here is the call graph for this function:

bool RelProject::isRenaming ( ) const

Definition at line 513 of file RelAlgDag.cpp.

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

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

+ Here is the call graph for this function:

bool RelProject::isSimple ( ) const
inline

Definition at line 1307 of file RelAlgDag.h.

References scalar_exprs_.

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

1307  {
1308  for (const auto& expr : scalar_exprs_) {
1309  if (!dynamic_cast<const RexInput*>(expr.get())) {
1310  return false;
1311  }
1312  }
1313  return true;
1314  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459

+ Here is the caller graph for this function:

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

Definition at line 1322 of file RelAlgDag.h.

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

Referenced by deepCopy().

1323  {
1324  if (isUpdateViaSelect()) {
1325  new_project_node->setUpdateViaSelectFlag(true);
1326  }
1327  if (isDeleteViaSelect()) {
1328  new_project_node->setDeleteViaSelectFlag(true);
1329  }
1330  if (isVarlenUpdateRequired()) {
1331  new_project_node->setVarlenUpdateRequired(true);
1332  }
1333  new_project_node->setModifiedTableDescriptor(getModifiedTableDescriptor());
1334  new_project_node->setTargetColumns(getTargetColumns());
1335  new_project_node->setModifiedTableCatalog(getModifiedTableCatalog());
1337  }
ColumnNameList const & getTargetColumns() const
Definition: RelAlgDag.h:1228
void resetModifyManipulationTarget() const
Definition: RelAlgDag.h:1339
auto const isDeleteViaSelect() const
Definition: RelAlgDag.h:1218
auto const isUpdateViaSelect() const
Definition: RelAlgDag.h:1217
auto const isVarlenUpdateRequired() const
Definition: RelAlgDag.h:1219
TableDescriptor const * getModifiedTableDescriptor() const
Definition: RelAlgDag.h:1205
const Catalog_Namespace::Catalog * getModifiedTableCatalog() const
Definition: RelAlgDag.h:1211

+ 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 1374 of file RelAlgDag.h.

1375  {
1376  replaceInput(old_input, input, std::nullopt);
1377  }
void replaceInput(std::shared_ptr< const RelAlgNode > old_input, std::shared_ptr< const RelAlgNode > input) override
Definition: RelAlgDag.h:1374
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 346 of file RelAlgDag.cpp.

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

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

+ Here is the call graph for this function:

void RelProject::resetModifyManipulationTarget ( ) const
inline

Definition at line 1339 of file RelAlgDag.h.

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

Referenced by propagateModifyManipulationTarget().

1339  {
1340  setModifiedTableDescriptor(nullptr);
1341  setModifiedTableCatalog(nullptr);
1342  setUpdateViaSelectFlag(false);
1343  setDeleteViaSelectFlag(false);
1344  setVarlenUpdateRequired(false);
1346  }
void setVarlenUpdateRequired(bool required) const
Definition: RelAlgDag.h:1200
void invalidateTargetColumns() const
Definition: RelAlgDag.h:1230
void setDeleteViaSelectFlag(bool required) const
Definition: RelAlgDag.h:1199
void setUpdateViaSelectFlag(bool required) const
Definition: RelAlgDag.h:1198
void setModifiedTableDescriptor(TableDescriptor const *td) const
Definition: RelAlgDag.h:1207
void setModifiedTableCatalog(const Catalog_Namespace::Catalog *catalog) const
Definition: RelAlgDag.h:1213

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1300 of file RelAlgDag.h.

References scalar_exprs_.

1300  {
1301  scalar_exprs_ = std::move(exprs);
1302  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
void RelProject::setFields ( std::vector< std::string > &&  fields)
inline

Definition at line 1367 of file RelAlgDag.h.

References fields_.

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

Definition at line 1350 of file RelAlgDag.h.

References has_pushed_down_window_expr_.

1350 { has_pushed_down_window_expr_ = true; }
has_pushed_down_window_expr_
Definition: RelAlgDag.h:1264
size_t RelProject::size ( ) const
inlineoverridevirtual
virtual size_t RelProject::toHash ( ) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1438 of file RelAlgDag.h.

References hash_value.

1438 { return hash_value(*this); }
friend std::size_t hash_value(RelProject const &)
Definition: RelAlgDag.cpp:3702
std::string RelProject::toString ( RelRexToStringConfig  config = RelRexToStringConfig::defaults()) const
inlineoverridevirtual

Implements RelAlgNode.

Definition at line 1387 of file RelAlgDag.h.

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

1388  {
1389  if (!config.attributes_only) {
1390  auto ret = cat(::typeName(this), "(");
1391  for (auto& expr : scalar_exprs_) {
1392  ret += expr->toString(config) + " ";
1393  }
1394  return cat(ret, ", ", ::toString(fields_), ")");
1395  } else {
1396  return cat(::typeName(this), "(", ::toString(fields_), ")");
1397  }
1398  }
std::string cat(Ts &&...args)
std::vector< std::string > fields_
Definition: RelAlgDag.h:1460
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459
std::string typeName(const T *v)
Definition: toString.h:106
std::string toString(RelRexToStringConfig config=RelRexToStringConfig::defaults()) const override
Definition: RelAlgDag.h:1387

+ Here is the call graph for this function:

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

Definition at line 1444 of file RelAlgDag.h.

References scalar_exprs_.

1444  {
1445  for (int i = 0; i < static_cast<int>(scalar_exprs_.size()); i++) {
1446  visitor_functor(i);
1447  }
1448  }
std::vector< std::unique_ptr< const RexScalar > > scalar_exprs_
Definition: RelAlgDag.h:1459

Friends And Related Function Documentation

std::size_t hash_value ( RelProject const &  rel_project)
friend

Definition at line 3702 of file RelAlgDag.cpp.

Referenced by toHash().

3702  {
3703  if (rel_project.hash_) {
3704  return *rel_project.hash_;
3705  }
3706  rel_project.hash_ = typeid(RelProject).hash_code();
3707  boost::hash_combine(*rel_project.hash_, rel_project.scalar_exprs_);
3708  boost::hash_combine(*rel_project.hash_, rel_project.fields_);
3709  boost::hash_combine(*rel_project.hash_, rel_project.inputs_);
3710  return *rel_project.hash_;
3711 }
RelProject(const TableDescriptor *td, const Catalog_Namespace::Catalog *catalog)
Definition: RelAlgDag.h:1261
friend struct RelAlgDagSerializer
friend

Definition at line 1465 of file RelAlgDag.h.

friend class RelModify
friend

Definition at line 1256 of file RelAlgDag.h.

Member Data Documentation

RelProject::catalog

Definition at line 1262 of file RelAlgDag.h.

std::vector<std::string> RelProject::fields_
mutableprivate
RelProject::has_pushed_down_window_expr_
Initial value:
{false} {}
RelProject(std::vector<std::unique_ptr<const RexScalar>>& scalar_exprs,
const std::vector<std::string>& fields,
std::shared_ptr<const RelAlgNode> input)

Definition at line 1264 of file RelAlgDag.h.

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

bool RelProject::has_pushed_down_window_expr_
private

Definition at line 1463 of file RelAlgDag.h.

RelProject::hint_applied_ {false}

Definition at line 1263 of file RelAlgDag.h.

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

bool RelProject::hint_applied_
private

Definition at line 1461 of file RelAlgDag.h.

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

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