OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 42 of file QueryPhysicalInputsCollector.cpp.

Member Function Documentation

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  }
PhysicalInputSet anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitInput ( const RexInput input) const
inlineoverridevirtual

Implements RexVisitorBase< PhysicalInputSet >.

Definition at line 44 of file QueryPhysicalInputsCollector.cpp.

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

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

+ Here is the call graph for this function:

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

Implements RexVisitorBase< PhysicalInputSet >.

Definition at line 71 of file QueryPhysicalInputsCollector.cpp.

References CHECK_EQ, CHECK_LT, get_node_output(), RexOperator::getOperand(), run_benchmark_import::result, and RexOperator::size().

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

+ Here is the call graph for this function:

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

Implements RexVisitorBase< PhysicalInputSet >.

Definition at line 64 of file QueryPhysicalInputsCollector.cpp.

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

64  {
65  const auto ra = subquery->getRelAlg();
66  CHECK(ra);
67  RelAlgPhysicalInputsVisitor visitor;
68  return visitor.visit(ra);
69  }
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the call graph for this function:


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