OmniSciDB  dfae7c3b14
anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor Class Reference
+ Inheritance diagram for anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor:
+ Collaboration diagram for anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor:

Public Member Functions

 RexRebindInputsVisitor (const RelAlgNode *old_input, const RelAlgNode *new_input)
 
void * visitInput (const RexInput *rex_input) const override
 
void visitNode (const RelAlgNode *node) const
 
- Public Member Functions inherited from RexVisitor< void *>
void * visitInput (const RexInput *) const override
 
void * visitLiteral (const RexLiteral *) const override
 
void * visitSubQuery (const RexSubQuery *) const override
 
void * visitRef (const RexRef *) const override
 
void * visitOperator (const RexOperator *rex_operator) const override
 
void * visitCase (const RexCase *rex_case) const override
 
- Public Member Functions inherited from RexVisitorBase< void * >
virtual void * visit (const RexScalar *rex_scalar) const
 

Private Attributes

const RelAlgNodeold_input_
 
const RelAlgNodenew_input_
 

Additional Inherited Members

- Protected Member Functions inherited from RexVisitor< void *>
virtual void * aggregateResult (const void * &aggregate, const void * &next_result) const
 
void * defaultResult () const override
 

Detailed Description

Definition at line 57 of file RelAlgOptimizer.cpp.

Constructor & Destructor Documentation

◆ RexRebindInputsVisitor()

anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor::RexRebindInputsVisitor ( const RelAlgNode old_input,
const RelAlgNode new_input 
)
inline

Member Function Documentation

◆ visitInput()

void* anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor::visitInput ( const RexInput rex_input) const
inlineoverridevirtual

Implements RexVisitorBase< void * >.

Definition at line 62 of file RelAlgOptimizer.cpp.

References RexInput::getSourceNode(), and RexInput::setSourceNode().

62  {
63  const auto old_source = rex_input->getSourceNode();
64  if (old_source == old_input_) {
65  rex_input->setSourceNode(new_input_);
66  }
67  return nullptr;
68  };
void setSourceNode(const RelAlgNode *node) const
const RelAlgNode * getSourceNode() const
+ Here is the call graph for this function:

◆ visitNode()

void anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor::visitNode ( const RelAlgNode node) const
inline

Definition at line 70 of file RelAlgOptimizer.cpp.

References CHECK, and join().

Referenced by anonymous_namespace{RelAlgOptimizer.cpp}::redirect_inputs_of(), and anonymous_namespace{RelAlgOptimizer.cpp}::try_insert_coalesceable_proj().

70  {
71  if (dynamic_cast<const RelAggregate*>(node) || dynamic_cast<const RelSort*>(node)) {
72  return;
73  }
74  if (auto join = dynamic_cast<const RelJoin*>(node)) {
75  if (auto condition = join->getCondition()) {
76  visit(condition);
77  }
78  return;
79  }
80  if (auto project = dynamic_cast<const RelProject*>(node)) {
81  for (size_t i = 0; i < project->size(); ++i) {
82  visit(project->getProjectAt(i));
83  }
84  return;
85  }
86  if (auto filter = dynamic_cast<const RelFilter*>(node)) {
87  visit(filter->getCondition());
88  return;
89  }
90  CHECK(false);
91  }
std::string join(T const &container, std::string const &delim)
virtual void * visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ new_input_

const RelAlgNode* anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor::new_input_
private

Definition at line 95 of file RelAlgOptimizer.cpp.

◆ old_input_

const RelAlgNode* anonymous_namespace{RelAlgOptimizer.cpp}::RexRebindInputsVisitor::old_input_
private

Definition at line 94 of file RelAlgOptimizer.cpp.


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