OmniSciDB  c07336695a
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 56 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 61 of file RelAlgOptimizer.cpp.

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

61  {
62  const auto old_source = rex_input->getSourceNode();
63  if (old_source == old_input_) {
64  rex_input->setSourceNode(new_input_);
65  }
66  return nullptr;
67  };
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 69 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().

69  {
70  if (dynamic_cast<const RelAggregate*>(node) || dynamic_cast<const RelSort*>(node)) {
71  return;
72  }
73  if (auto join = dynamic_cast<const RelJoin*>(node)) {
74  if (auto condition = join->getCondition()) {
75  visit(condition);
76  }
77  return;
78  }
79  if (auto project = dynamic_cast<const RelProject*>(node)) {
80  for (size_t i = 0; i < project->size(); ++i) {
81  visit(project->getProjectAt(i));
82  }
83  return;
84  }
85  if (auto filter = dynamic_cast<const RelFilter*>(node)) {
86  visit(filter->getCondition());
87  return;
88  }
89  CHECK(false);
90  }
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:187
+ 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 94 of file RelAlgOptimizer.cpp.

◆ old_input_

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

Definition at line 93 of file RelAlgOptimizer.cpp.


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