OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelAlgDag.h File Reference
#include <atomic>
#include <iterator>
#include <memory>
#include <optional>
#include <unordered_map>
#include <rapidjson/document.h>
#include <boost/core/noncopyable.hpp>
#include <boost/functional/hash.hpp>
#include "Catalog/Catalog.h"
#include "QueryEngine/QueryHint.h"
#include "QueryEngine/Rendering/RenderInfo.h"
#include "QueryEngine/TargetMetaInfo.h"
#include "QueryEngine/TypePunning.h"
#include "Shared/toString.h"
#include "Utils/FsiUtils.h"
+ Include dependency graph for RelAlgDag.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Namespaces

 std
 
 boost
 

Macros

#define HEAVYAI_SPECIALIZE_HASH_VALUE_OF_POINTER(T)
 

Typedefs

using RelAlgInputs = std::vector< std::shared_ptr< const RelAlgNode >>
 
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

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

Variables

constexpr size_t boost::HASH_NULLPTR {0u}
 

Macro Definition Documentation

#define HEAVYAI_SPECIALIZE_HASH_VALUE_OF_POINTER (   T)
Value:
template <> \
inline std::size_t hash_value(T const* const& ptr) { \
return ptr ? ptr->toHash() : HASH_NULLPTR; \
} \
template <> \
inline std::size_t hash_value(T* const& ptr) { \
return ptr ? ptr->toHash() : HASH_NULLPTR; \
}
std::size_t hash_value(RexAbstractInput const &rex_ab_input)
Definition: RelAlgDag.cpp:3548
constexpr size_t HASH_NULLPTR
Definition: RelAlgDag.h:3470

Definition at line 3471 of file RelAlgDag.h.

Typedef Documentation

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

Definition at line 72 of file RelAlgDag.h.

using RANodeOutput = std::vector<RexInput>

Definition at line 3461 of file RelAlgDag.h.

using RelAlgInputs = std::vector<std::shared_ptr<const RelAlgNode>>

Definition at line 71 of file RelAlgDag.h.

using RexLiteralArray = std::vector<RexLiteral>

Definition at line 333 of file RelAlgDag.h.

using TupleContentsArray = std::vector<RexLiteralArray>

Definition at line 334 of file RelAlgDag.h.

Enumeration Type Documentation

enum NullSortedPosition
strong
Enumerator
First 
Last 

Definition at line 533 of file RelAlgDag.h.

enum SortDirection
strong
Enumerator
Ascending 
Descending 

Definition at line 531 of file RelAlgDag.h.

Function Documentation

RANodeOutput get_node_output ( const RelAlgNode ra_node)

Definition at line 371 of file RelAlgDag.cpp.

References CHECK_EQ, logger::FATAL, get_node_output(), LOG, anonymous_namespace{RelAlgDag.cpp}::n_outputs(), and toString().

Referenced by anonymous_namespace{RelAlgDag.cpp}::bind_inputs(), anonymous_namespace{RelAlgDag.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().

371  {
372  const auto scan_node = dynamic_cast<const RelScan*>(ra_node);
373  if (scan_node) {
374  // Scan node has no inputs, output contains all columns in the table.
375  CHECK_EQ(size_t(0), scan_node->inputCount());
376  return n_outputs(scan_node, scan_node->size());
377  }
378  const auto project_node = dynamic_cast<const RelProject*>(ra_node);
379  if (project_node) {
380  // Project output count doesn't depend on the input
381  CHECK_EQ(size_t(1), project_node->inputCount());
382  return n_outputs(project_node, project_node->size());
383  }
384  const auto filter_node = dynamic_cast<const RelFilter*>(ra_node);
385  if (filter_node) {
386  // Filter preserves shape
387  CHECK_EQ(size_t(1), filter_node->inputCount());
388  const auto prev_out = get_node_output(filter_node->getInput(0));
389  return n_outputs(filter_node, prev_out.size());
390  }
391  const auto aggregate_node = dynamic_cast<const RelAggregate*>(ra_node);
392  if (aggregate_node) {
393  // Aggregate output count doesn't depend on the input
394  CHECK_EQ(size_t(1), aggregate_node->inputCount());
395  return n_outputs(aggregate_node, aggregate_node->size());
396  }
397  const auto compound_node = dynamic_cast<const RelCompound*>(ra_node);
398  if (compound_node) {
399  // Compound output count doesn't depend on the input
400  CHECK_EQ(size_t(1), compound_node->inputCount());
401  return n_outputs(compound_node, compound_node->size());
402  }
403  const auto join_node = dynamic_cast<const RelJoin*>(ra_node);
404  if (join_node) {
405  // Join concatenates the outputs from the inputs and the output
406  // directly references the nodes in the input.
407  CHECK_EQ(size_t(2), join_node->inputCount());
408  auto lhs_out =
409  n_outputs(join_node->getInput(0), get_node_output(join_node->getInput(0)).size());
410  const auto rhs_out =
411  n_outputs(join_node->getInput(1), get_node_output(join_node->getInput(1)).size());
412  lhs_out.insert(lhs_out.end(), rhs_out.begin(), rhs_out.end());
413  return lhs_out;
414  }
415  const auto table_func_node = dynamic_cast<const RelTableFunction*>(ra_node);
416  if (table_func_node) {
417  // Table Function output count doesn't depend on the input
418  return n_outputs(table_func_node, table_func_node->size());
419  }
420  const auto sort_node = dynamic_cast<const RelSort*>(ra_node);
421  if (sort_node) {
422  // Sort preserves shape
423  CHECK_EQ(size_t(1), sort_node->inputCount());
424  const auto prev_out = get_node_output(sort_node->getInput(0));
425  return n_outputs(sort_node, prev_out.size());
426  }
427  const auto logical_values_node = dynamic_cast<const RelLogicalValues*>(ra_node);
428  if (logical_values_node) {
429  CHECK_EQ(size_t(0), logical_values_node->inputCount());
430  return n_outputs(logical_values_node, logical_values_node->size());
431  }
432  const auto logical_union_node = dynamic_cast<const RelLogicalUnion*>(ra_node);
433  if (logical_union_node) {
434  return n_outputs(logical_union_node, logical_union_node->size());
435  }
436  LOG(FATAL) << "Unhandled ra_node type: " << ::toString(ra_node);
437  return {};
438 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
#define LOG(tag)
Definition: Logger.h:285
std::string toString(const Executor::ExtModuleKinds &kind)
Definition: Execute.h:1703
std::vector< RexInput > n_outputs(const RelAlgNode *node, const size_t n)
Definition: RelAlgDag.cpp:96
RANodeOutput get_node_output(const RelAlgNode *ra_node)
Definition: RelAlgDag.cpp:371

+ 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  depth = 0 
)

Definition at line 3480 of file RelAlgDag.cpp.

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

Referenced by tree_string().

3480  {
3481  std::string result = std::string(2 * depth, ' ') + ::toString(ra) + '\n';
3482  for (size_t i = 0; i < ra->inputCount(); ++i) {
3483  result += tree_string(ra->getInput(i), depth + 1);
3484  }
3485  return result;
3486 }
std::string toString(const Executor::ExtModuleKinds &kind)
Definition: Execute.h:1703
std::string tree_string(const RelAlgNode *ra, const size_t depth)
Definition: RelAlgDag.cpp:3480

+ Here is the call graph for this function:

+ Here is the caller graph for this function: