OmniSciDB  c07336695a
anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector Class Reference
+ Inheritance diagram for anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector:
+ Collaboration diagram for anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector:

Public Member Functions

 RexProjectInputRedirector (const std::unordered_set< const RelProject *> &crt_inputs)
 
RetType visitInput (const RexInput *input) const override
 
- Public Member Functions inherited from RexVisitorBase< std::unique_ptr< const RexScalar > >
virtual std::unique_ptr< const RexScalarvisit (const RexScalar *rex_scalar) const
 

Private Attributes

const std::unordered_set< const RelProject * > & crt_projects_
 

Additional Inherited Members

- Protected Types inherited from RexDeepCopyVisitor
using RetType = std::unique_ptr< const RexScalar >
 
- Protected Member Functions inherited from RexDeepCopyVisitor
RetType visitInput (const RexInput *input) const override
 
RetType visitLiteral (const RexLiteral *literal) const override
 
RetType visitSubQuery (const RexSubQuery *subquery) const override
 
RetType visitRef (const RexRef *ref) const override
 
RetType visitOperator (const RexOperator *rex_operator) const override
 
RetType visitCase (const RexCase *rex_case) const override
 

Detailed Description

Definition at line 27 of file RelAlgOptimizer.cpp.

Constructor & Destructor Documentation

◆ RexProjectInputRedirector()

anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector::RexProjectInputRedirector ( const std::unordered_set< const RelProject *> &  crt_inputs)
inline

Definition at line 29 of file RelAlgOptimizer.cpp.

30  : crt_projects_(crt_inputs) {}
const std::unordered_set< const RelProject * > & crt_projects_

Member Function Documentation

◆ visitInput()

RetType anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector::visitInput ( const RexInput input) const
inlineoverridevirtual

Implements RexVisitorBase< std::unique_ptr< const RexScalar > >.

Definition at line 32 of file RelAlgOptimizer.cpp.

References CHECK, CHECK_EQ, RexInput::deepCopy(), RexAbstractInput::getIndex(), RexInput::getSourceNode(), and join().

32  {
33  auto source = dynamic_cast<const RelProject*>(input->getSourceNode());
34  if (!source || !crt_projects_.count(source)) {
35  return input->deepCopy();
36  }
37  auto new_source = source->getInput(0);
38  auto new_input =
39  dynamic_cast<const RexInput*>(source->getProjectAt(input->getIndex()));
40  if (!new_input) {
41  return input->deepCopy();
42  }
43  if (auto join = dynamic_cast<const RelJoin*>(new_source)) {
44  CHECK(new_input->getSourceNode() == join->getInput(0) ||
45  new_input->getSourceNode() == join->getInput(1));
46  } else {
47  CHECK_EQ(new_input->getSourceNode(), new_source);
48  }
49  return new_input->deepCopy();
50  }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
std::string join(T const &container, std::string const &delim)
const std::unordered_set< const RelProject * > & crt_projects_
std::unique_ptr< RexInput > deepCopy() const
const RelAlgNode * getSourceNode() const
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the call graph for this function:

Member Data Documentation

◆ crt_projects_

const std::unordered_set<const RelProject*>& anonymous_namespace{RelAlgOptimizer.cpp}::RexProjectInputRedirector::crt_projects_
private

Definition at line 53 of file RelAlgOptimizer.cpp.


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