OmniSciDB  0bd2ec9cf4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RelAlgDagBuilder.h File Reference
#include <iterator>
#include <memory>
#include <unordered_map>
#include <rapidjson/document.h>
#include <boost/core/noncopyable.hpp>
#include "Catalog/Catalog.h"
#include "Shared/ConfigResolve.h"
#include "Shared/sql_window_function_to_string.h"
#include "QueryEngine/Rendering/RenderInfo.h"
#include "QueryEngine/TargetMetaInfo.h"
#include "QueryEngine/TypePunning.h"
+ Include dependency graph for RelAlgDagBuilder.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Rex
 
class  RexScalar
 
class  RexAbstractInput
 
class  RexLiteral
 
class  RexOperator
 
class  RexSubQuery
 
class  RexInput
 
struct  std::hash< RexInput >
 
class  RexCase
 
class  RexFunctionOperator
 
class  SortField
 
class  RexWindowFunctionOperator
 
struct  RexWindowFunctionOperator::RexWindowBound
 
class  RexRef
 
class  RexAgg
 
class  RelAlgNode
 
class  RelScan
 
class  ModifyManipulationTarget
 
class  RelProject
 
class  RelAggregate
 
class  RelJoin
 
class  RelFilter
 
class  RelLeftDeepInnerJoin
 
class  RelCompound
 
class  RelSort
 
class  RelModify
 
class  RelTableFunction
 
class  RelLogicalValues
 
class  QueryNotSupported
 
class  RelAlgDagBuilder
 

Namespaces

 std
 

Typedefs

using ColumnNameList = std::vector< std::string >
 
using RexLiteralArray = std::vector< RexLiteral >
 
using TupleContentsArray = std::vector< RexLiteralArray >
 
using RANodeOutput = std::vector< RexInput >
 

Enumerations

enum  SortDirection { SortDirection::Ascending, SortDirection::Descending }
 
enum  NullSortedPosition { NullSortedPosition::First, NullSortedPosition::Last }
 

Functions

std::string tree_string (const RelAlgNode *, const size_t indent=0)
 
RANodeOutput get_node_output (const RelAlgNode *ra_node)
 

Typedef Documentation

using ColumnNameList = std::vector<std::string>

Definition at line 34 of file RelAlgDagBuilder.h.

using RANodeOutput = std::vector<RexInput>

Definition at line 1564 of file RelAlgDagBuilder.h.

using RexLiteralArray = std::vector<RexLiteral>

Definition at line 207 of file RelAlgDagBuilder.h.

using TupleContentsArray = std::vector<RexLiteralArray>

Definition at line 208 of file RelAlgDagBuilder.h.

Enumeration Type Documentation

enum NullSortedPosition
strong
Enumerator
First 
Last 

Definition at line 421 of file RelAlgDagBuilder.h.

enum SortDirection
strong
Enumerator
Ascending 
Descending 

Definition at line 419 of file RelAlgDagBuilder.h.

Function Documentation

RANodeOutput get_node_output ( const RelAlgNode ra_node)

Definition at line 112 of file RelAlgDagBuilder.cpp.

References CHECK(), CHECK_EQ, get_node_output(), and anonymous_namespace{RelAlgDagBuilder.cpp}::n_outputs().

Referenced by anonymous_namespace{RelAlgDagBuilder.cpp}::bind_inputs(), anonymous_namespace{RelAlgDagBuilder.cpp}::create_compound(), anonymous_namespace{RelAlgExecutor.cpp}::get_left_deep_join_input_sizes(), get_node_output(), RelProject::isIdentity(), anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitInput(), and anonymous_namespace{QueryPhysicalInputsCollector.cpp}::RexPhysicalInputsVisitor::visitOperator().

112  {
113  RANodeOutput outputs;
114  const auto scan_node = dynamic_cast<const RelScan*>(ra_node);
115  if (scan_node) {
116  // Scan node has no inputs, output contains all columns in the table.
117  CHECK_EQ(size_t(0), scan_node->inputCount());
118  return n_outputs(scan_node, scan_node->size());
119  }
120  const auto project_node = dynamic_cast<const RelProject*>(ra_node);
121  if (project_node) {
122  // Project output count doesn't depend on the input
123  CHECK_EQ(size_t(1), project_node->inputCount());
124  return n_outputs(project_node, project_node->size());
125  }
126  const auto filter_node = dynamic_cast<const RelFilter*>(ra_node);
127  if (filter_node) {
128  // Filter preserves shape
129  CHECK_EQ(size_t(1), filter_node->inputCount());
130  const auto prev_out = get_node_output(filter_node->getInput(0));
131  return n_outputs(filter_node, prev_out.size());
132  }
133  const auto aggregate_node = dynamic_cast<const RelAggregate*>(ra_node);
134  if (aggregate_node) {
135  // Aggregate output count doesn't depend on the input
136  CHECK_EQ(size_t(1), aggregate_node->inputCount());
137  return n_outputs(aggregate_node, aggregate_node->size());
138  }
139  const auto compound_node = dynamic_cast<const RelCompound*>(ra_node);
140  if (compound_node) {
141  // Compound output count doesn't depend on the input
142  CHECK_EQ(size_t(1), compound_node->inputCount());
143  return n_outputs(compound_node, compound_node->size());
144  }
145  const auto join_node = dynamic_cast<const RelJoin*>(ra_node);
146  if (join_node) {
147  // Join concatenates the outputs from the inputs and the output
148  // directly references the nodes in the input.
149  CHECK_EQ(size_t(2), join_node->inputCount());
150  auto lhs_out =
151  n_outputs(join_node->getInput(0), get_node_output(join_node->getInput(0)).size());
152  const auto rhs_out =
153  n_outputs(join_node->getInput(1), get_node_output(join_node->getInput(1)).size());
154  lhs_out.insert(lhs_out.end(), rhs_out.begin(), rhs_out.end());
155  return lhs_out;
156  }
157  const auto table_func_node = dynamic_cast<const RelTableFunction*>(ra_node);
158  if (table_func_node) {
159  // Table Function output count doesn't depend on the input
160  CHECK_EQ(size_t(1), table_func_node->inputCount());
161  return n_outputs(table_func_node, table_func_node->size());
162  }
163  const auto sort_node = dynamic_cast<const RelSort*>(ra_node);
164  if (sort_node) {
165  // Sort preserves shape
166  CHECK_EQ(size_t(1), sort_node->inputCount());
167  const auto prev_out = get_node_output(sort_node->getInput(0));
168  return n_outputs(sort_node, prev_out.size());
169  }
170  const auto logical_values_node = dynamic_cast<const RelLogicalValues*>(ra_node);
171  if (logical_values_node) {
172  CHECK_EQ(size_t(0), logical_values_node->inputCount());
173  return n_outputs(logical_values_node, logical_values_node->size());
174  }
175  CHECK(false);
176  return outputs;
177 }
#define CHECK_EQ(x, y)
Definition: Logger.h:201
CHECK(cgen_state)
RANodeOutput get_node_output(const RelAlgNode *ra_node)
std::vector< RexInput > RANodeOutput
std::vector< RexInput > n_outputs(const RelAlgNode *node, const size_t n)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string tree_string ( const RelAlgNode ,
const size_t  indent = 0 
)

Definition at line 2200 of file RelAlgDagBuilder.cpp.

References RelAlgNode::getInput(), RelAlgNode::inputCount(), run_benchmark_import::result, RelAlgNode::toString(), and tree_string().

Referenced by tree_string().

2200  {
2201  std::string result = std::string(indent, ' ') + ra->toString() + "\n";
2202  for (size_t i = 0; i < ra->inputCount(); ++i) {
2203  result += tree_string(ra->getInput(i), indent + 2);
2204  }
2205  return result;
2206 }
std::string tree_string(const RelAlgNode *ra, const size_t indent)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: