OmniSciDB  04ee39c94c
anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor Class Reference
+ Inheritance diagram for anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor:
+ Collaboration diagram for anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor:

Public Member Functions

PhysicalInputSet visitInput (const RexInput *input) const override
 
PhysicalInputSet visitSubQuery (const RexSubQuery *subquery) const override
 
PhysicalInputSet visitOperator (const RexOperator *oper) const override
 
- Public Member Functions inherited from RexVisitor< PhysicalInputSet >
PhysicalInputSet visitInput (const RexInput *) const override
 
PhysicalInputSet visitLiteral (const RexLiteral *) const override
 
PhysicalInputSet visitSubQuery (const RexSubQuery *) const override
 
PhysicalInputSet visitRef (const RexRef *) const override
 
PhysicalInputSet visitOperator (const RexOperator *rex_operator) const override
 
PhysicalInputSet visitCase (const RexCase *rex_case) const override
 
- Public Member Functions inherited from RexVisitorBase< PhysicalInputSet >
virtual PhysicalInputSet visit (const RexScalar *rex_scalar) const
 

Protected Member Functions

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

Detailed Description

Definition at line 41 of file QueryPhysicalInputsCollector.cpp.

Member Function Documentation

◆ aggregateResult()

PhysicalInputSet anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::aggregateResult ( const PhysicalInputSet aggregate,
const PhysicalInputSet next_result 
) const
inlineoverrideprotected

Definition at line 99 of file QueryPhysicalInputsCollector.cpp.

References run-benchmark-import::result.

100  {
101  auto result = aggregate;
102  result.insert(next_result.begin(), next_result.end());
103  return result;
104  }

◆ visitInput()

PhysicalInputSet anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitInput ( const RexInput input) const
inlineoverridevirtual

Implements RexVisitorBase< PhysicalInputSet >.

Definition at line 43 of file QueryPhysicalInputsCollector.cpp.

References CHECK, CHECK_GT, CHECK_LT, get_node_output(), RexAbstractInput::getIndex(), and RexInput::getSourceNode().

43  {
44  const auto source_ra = input->getSourceNode();
45  const auto scan_ra = dynamic_cast<const RelScan*>(source_ra);
46  if (!scan_ra) {
47  const auto join_ra = dynamic_cast<const RelJoin*>(source_ra);
48  if (join_ra) {
49  const auto node_inputs = get_node_output(join_ra);
50  CHECK_LT(input->getIndex(), node_inputs.size());
51  return visitInput(&node_inputs[input->getIndex()]);
52  }
53  return PhysicalInputSet{};
54  }
55  const auto scan_td = scan_ra->getTableDescriptor();
56  CHECK(scan_td);
57  const int col_id = input->getIndex() + 1;
58  const int table_id = scan_td->tableId;
59  CHECK_GT(table_id, 0);
60  return {{col_id, table_id}};
61  }
#define CHECK_GT(x, y)
Definition: Logger.h:199
const RelAlgNode * getSourceNode() const
#define CHECK_LT(x, y)
Definition: Logger.h:197
RANodeOutput get_node_output(const RelAlgNode *ra_node)
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the call graph for this function:

◆ visitOperator()

PhysicalInputSet anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitOperator ( const RexOperator oper) const
inlineoverridevirtual

Implements RexVisitorBase< PhysicalInputSet >.

Definition at line 70 of file QueryPhysicalInputsCollector.cpp.

References CHECK_EQ, CHECK_LT, get_node_output(), RexOperator::getOperand(), run-benchmark-import::result, and RexOperator::size().

70  {
72  if (auto window_oper = dynamic_cast<const RexWindowFunctionOperator*>(oper)) {
73  for (const auto& partition_key : window_oper->getPartitionKeys()) {
74  if (auto input = dynamic_cast<const RexInput*>(partition_key.get())) {
75  const auto source_node = input->getSourceNode();
76  if (auto filter_node = dynamic_cast<const RelFilter*>(source_node)) {
77  // Partitions utilize string dictionary translation in the hash join framework
78  // if the partition key is a dictionary encoded string. Ensure we reach the
79  // source for all partition keys, so we can access string dictionaries for the
80  // partition keys while we build the partition (hash) table
81  CHECK_EQ(filter_node->inputCount(), size_t(1));
82  const auto parent_node = filter_node->getInput(0);
83  const auto node_inputs = get_node_output(parent_node);
84  CHECK_LT(input->getIndex(), node_inputs.size());
85  result = aggregateResult(result, visitInput(&node_inputs[input->getIndex()]));
86  }
87  result = aggregateResult(result, visit(input));
88  }
89  }
90  return result;
91  }
92  for (size_t i = 0; i < oper->size(); i++) {
93  result = aggregateResult(result, visit(oper->getOperand(i)));
94  }
95  return result;
96  }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
PhysicalInputSet aggregateResult(const PhysicalInputSet &aggregate, const PhysicalInputSet &next_result) const override
const RexScalar * getOperand(const size_t idx) const
virtual PhysicalInputSet visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
#define CHECK_LT(x, y)
Definition: Logger.h:197
RANodeOutput get_node_output(const RelAlgNode *ra_node)
+ Here is the call graph for this function:

◆ visitSubQuery()

PhysicalInputSet anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitSubQuery ( const RexSubQuery subquery) const
inlineoverridevirtual

Implements RexVisitorBase< PhysicalInputSet >.

Definition at line 63 of file QueryPhysicalInputsCollector.cpp.

References CHECK, and RelAlgVisitor< T >::visit().

63  {
64  const auto ra = subquery->getRelAlg();
65  CHECK(ra);
66  RelAlgPhysicalInputsVisitor visitor;
67  return visitor.visit(ra);
68  }
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the call graph for this function:

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