OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
RexScalar
visit (const RexScalar *rex_scalar) const
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from RexDeepCopyVisitor
using RowValues = std::vector< std::unique_ptr< const RexScalar >>
 
- Static Public Member Functions inherited from RexDeepCopyVisitor
static std::vector< RowValuescopy (std::vector< RowValues > const &rhs)
 
- 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 visitWindowFunctionOperator (const RexWindowFunctionOperator *rex_window_function_operator) const
 
RetType visitCase (const RexCase *rex_case) const override
 

Detailed Description

Definition at line 28 of file RelAlgOptimizer.cpp.

Constructor & Destructor Documentation

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

Definition at line 30 of file RelAlgOptimizer.cpp.

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

Member Function Documentation

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

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

Definition at line 33 of file RelAlgOptimizer.cpp.

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

33  {
34  auto source = dynamic_cast<const RelProject*>(input->getSourceNode());
35  if (!source || !crt_projects_.count(source)) {
36  return input->deepCopy();
37  }
38  auto new_source = source->getInput(0);
39  auto new_input =
40  dynamic_cast<const RexInput*>(source->getProjectAt(input->getIndex()));
41  if (!new_input) {
42  return input->deepCopy();
43  }
44  if (auto join = dynamic_cast<const RelJoin*>(new_source)) {
45  CHECK(new_input->getSourceNode() == join->getInput(0) ||
46  new_input->getSourceNode() == join->getInput(1));
47  } else {
48  CHECK_EQ(new_input->getSourceNode(), new_source);
49  }
50  return new_input->deepCopy();
51  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
std::string join(T const &container, std::string const &delim)
const std::unordered_set< const RelProject * > & crt_projects_
unsigned getIndex() const
Definition: RelAlgDag.h:174
std::unique_ptr< RexInput > deepCopy() const
Definition: RelAlgDag.h:1070
const RelAlgNode * getSourceNode() const
Definition: RelAlgDag.h:1056
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 54 of file RelAlgOptimizer.cpp.


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