OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelAlgExecutionUnit.h File Reference

Execution unit for relational algebra. It's a low-level description of any relational algebra operation in a format understood by our VM. More...

#include "Descriptors/InputDescriptors.h"
#include "QueryHint.h"
#include "RelAlgDag.h"
#include "Shared/DbObjectKeys.h"
#include "Shared/sqldefs.h"
#include "Shared/toString.h"
#include "TableFunctions/TableFunctionOutputBufferSizeType.h"
#include "TableFunctions/TableFunctionsFactory.h"
#include "ThriftHandler/QueryState.h"
#include <boost/graph/adjacency_list.hpp>
#include <functional>
#include <list>
#include <memory>
#include <optional>
#include <vector>
+ Include dependency graph for RelAlgExecutionUnit.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HashTableBuildDag
 
struct  SortInfo
 
struct  JoinCondition
 
struct  RelAlgExecutionUnit
 
struct  TableFunctionExecutionUnit
 

Namespaces

 Analyzer
 

Typedefs

using AdjacentList = boost::adjacency_list< boost::setS, boost::vecS, boost::directedS >
 
using RelNodeId = size_t
 
using RelNodeExplainedHash = size_t
 
using QueryPlanDAG = std::string
 
using QueryPlanHash = size_t
 
using HashTableBuildDagMap = std::unordered_map< size_t, HashTableBuildDag >
 
using TableIdToNodeMap = std::unordered_map< shared::TableKey, const RelAlgNode * >
 
using JoinQualsPerNestingLevel = std::vector< JoinCondition >
 
using ResultSetPtr = std::shared_ptr< ResultSet >
 

Enumerations

enum  JoinColumnSide { kInner, kOuter, kQual, kDirect }
 
enum  SortAlgorithm { SortAlgorithm::Default, SortAlgorithm::SpeculativeTopN, SortAlgorithm::StreamingTopN }
 

Functions

std::ostream & operator<< (std::ostream &os, const RelAlgExecutionUnit &ra_exe_unit)
 

Variables

constexpr char const * EMPTY_QUERY_PLAN = ""
 
constexpr QueryPlanHash EMPTY_HASHED_PLAN_DAG_KEY = 0
 

Detailed Description

Execution unit for relational algebra. It's a low-level description of any relational algebra operation in a format understood by our VM.

Definition in file RelAlgExecutionUnit.h.

Typedef Documentation

using AdjacentList = boost::adjacency_list<boost::setS, boost::vecS, boost::directedS>

Definition at line 44 of file RelAlgExecutionUnit.h.

using HashTableBuildDagMap = std::unordered_map<size_t, HashTableBuildDag>

Definition at line 87 of file RelAlgExecutionUnit.h.

Definition at line 163 of file RelAlgExecutionUnit.h.

using QueryPlanDAG = std::string

Definition at line 57 of file RelAlgExecutionUnit.h.

using QueryPlanHash = size_t

Definition at line 59 of file RelAlgExecutionUnit.h.

using RelNodeExplainedHash = size_t

Definition at line 52 of file RelAlgExecutionUnit.h.

using RelNodeId = size_t

Definition at line 50 of file RelAlgExecutionUnit.h.

using ResultSetPtr = std::shared_ptr<ResultSet>

Definition at line 231 of file RelAlgExecutionUnit.h.

using TableIdToNodeMap = std::unordered_map<shared::TableKey, const RelAlgNode*>

Definition at line 95 of file RelAlgExecutionUnit.h.

Enumeration Type Documentation

Enumerator
kInner 
kOuter 
kQual 
kDirect 

Definition at line 97 of file RelAlgExecutionUnit.h.

97  {
98  kInner,
99  kOuter,
100  kQual, // INNER + OUTER
101  kDirect // set target directly (i.e., put Analyzer::Expr* instead of
102  // Analyzer::BinOper*)
103 };
enum SortAlgorithm
strong
Enumerator
Default 
SpeculativeTopN 
StreamingTopN 

Definition at line 107 of file RelAlgExecutionUnit.h.

Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const RelAlgExecutionUnit ra_exe_unit 
)

Definition at line 2024 of file Execute.cpp.

References RelAlgExecutionUnit::estimator, anonymous_namespace{Execute.cpp}::expr_container_to_string(), RelAlgExecutionUnit::groupby_exprs, RelAlgExecutionUnit::input_col_descs, join(), RelAlgExecutionUnit::join_quals, RelAlgExecutionUnit::quals, RelAlgExecutionUnit::query_plan_dag_hash, RelAlgExecutionUnit::scan_limit, RelAlgExecutionUnit::simple_quals, anonymous_namespace{Execute.cpp}::sort_algorithm_to_string(), RelAlgExecutionUnit::sort_info, RelAlgExecutionUnit::target_exprs, to_string(), toString(), RelAlgExecutionUnit::union_all, and RelAlgExecutionUnit::use_bump_allocator.

2024  {
2025  os << "\n\tExtracted Query Plan Dag Hash: " << ra_exe_unit.query_plan_dag_hash;
2026  os << "\n\tTable/Col/Levels: ";
2027  for (const auto& input_col_desc : ra_exe_unit.input_col_descs) {
2028  const auto& scan_desc = input_col_desc->getScanDesc();
2029  os << "(" << scan_desc.getTableKey() << ", " << input_col_desc->getColId() << ", "
2030  << scan_desc.getNestLevel() << ") ";
2031  }
2032  if (!ra_exe_unit.simple_quals.empty()) {
2033  os << "\n\tSimple Quals: "
2035  ", ");
2036  }
2037  if (!ra_exe_unit.quals.empty()) {
2038  os << "\n\tQuals: "
2039  << boost::algorithm::join(expr_container_to_string(ra_exe_unit.quals), ", ");
2040  }
2041  if (!ra_exe_unit.join_quals.empty()) {
2042  os << "\n\tJoin Quals: ";
2043  for (size_t i = 0; i < ra_exe_unit.join_quals.size(); i++) {
2044  const auto& join_condition = ra_exe_unit.join_quals[i];
2045  os << "\t\t" << std::to_string(i) << " " << ::toString(join_condition.type);
2046  os << boost::algorithm::join(expr_container_to_string(join_condition.quals), ", ");
2047  }
2048  }
2049  if (!ra_exe_unit.groupby_exprs.empty()) {
2050  os << "\n\tGroup By: "
2052  ", ");
2053  }
2054  os << "\n\tProjected targets: "
2056  os << "\n\tHas Estimator: " << ::toString(ra_exe_unit.estimator == nullptr);
2057  os << "\n\tSort Info: ";
2058  const auto& sort_info = ra_exe_unit.sort_info;
2059  os << "\n\t Order Entries: "
2060  << boost::algorithm::join(expr_container_to_string(sort_info.order_entries), ", ");
2061  os << "\n\t Algorithm: " << sort_algorithm_to_string(sort_info.algorithm);
2062  std::string limit_str = sort_info.limit ? std::to_string(*sort_info.limit) : "N/A";
2063  os << "\n\t Limit: " << limit_str;
2064  os << "\n\t Offset: " << std::to_string(sort_info.offset);
2065  os << "\n\tScan Limit: " << std::to_string(ra_exe_unit.scan_limit);
2066  os << "\n\tBump Allocator: " << ::toString(ra_exe_unit.use_bump_allocator);
2067  if (ra_exe_unit.union_all) {
2068  os << "\n\tUnion: " << std::string(*ra_exe_unit.union_all ? "UNION ALL" : "UNION");
2069  }
2070  return os;
2071 }
std::vector< Analyzer::Expr * > target_exprs
QueryPlanHash query_plan_dag_hash
const std::optional< bool > union_all
std::string join(T const &container, std::string const &delim)
const std::list< std::shared_ptr< Analyzer::Expr > > groupby_exprs
std::string to_string(char const *&&v)
const JoinQualsPerNestingLevel join_quals
std::vector< std::string > expr_container_to_string(const T &expr_container)
Definition: Execute.cpp:1923
const std::shared_ptr< Analyzer::Estimator > estimator
std::string toString(const Executor::ExtModuleKinds &kind)
Definition: Execute.h:1703
std::string sort_algorithm_to_string(const SortAlgorithm algorithm)
Definition: Execute.cpp:1945
std::list< std::shared_ptr< Analyzer::Expr > > quals
std::list< std::shared_ptr< const InputColDescriptor > > input_col_descs
std::list< std::shared_ptr< Analyzer::Expr > > simple_quals

+ Here is the call graph for this function:

Variable Documentation

constexpr char const* EMPTY_QUERY_PLAN = ""