OmniSciDB  a5dc49c757
 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
 

Protected Member Functions

PhysicalInputSet aggregateResult (const PhysicalInputSet &aggregate, const PhysicalInputSet &next_result) const override
 

Detailed Description

Definition at line 43 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 101 of file QueryPhysicalInputsCollector.cpp.

References run_benchmark_import::result.

102  {
103  auto result = aggregate;
104  result.insert(next_result.begin(), next_result.end());
105  return result;
106  }
PhysicalInputSet anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitInput ( const RexInput input) const
inlineoverride

Definition at line 45 of file QueryPhysicalInputsCollector.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 73 of file QueryPhysicalInputsCollector.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 66 of file QueryPhysicalInputsCollector.cpp.

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

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

+ Here is the call graph for this function:


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