OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 "Shared/sqldefs.h"
#include "Shared/toString.h"
#include "TableFunctions/TableFunctionOutputBufferSizeType.h"
#include "TableFunctions/TableFunctionsFactory.h"
#include "ThriftHandler/QueryState.h"
#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  SortInfo
 
struct  JoinCondition
 
struct  RelAlgExecutionUnit
 
struct  TableFunctionExecutionUnit
 

Namespaces

 Analyzer
 

Typedefs

using JoinQualsPerNestingLevel = std::vector< JoinCondition >
 
using ResultSetPtr = std::shared_ptr< ResultSet >
 

Enumerations

enum  SortAlgorithm { SortAlgorithm::Default, SortAlgorithm::SpeculativeTopN, SortAlgorithm::StreamingTopN }
 

Functions

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

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.

Author
Alex Suhan alex@.nosp@m.mapd.nosp@m..com Copyright (c) 2016 MapD Technologies, Inc. All rights reserved.
Todd Mostak todd@.nosp@m.omni.nosp@m.sci.c.nosp@m.om Copyright (c) 2020 Omnisci, Inc. All rights reserved.

Definition in file RelAlgExecutionUnit.h.

Typedef Documentation

Definition at line 64 of file RelAlgExecutionUnit.h.

using ResultSetPtr = std::shared_ptr<ResultSet>

Definition at line 107 of file RelAlgExecutionUnit.h.

Enumeration Type Documentation

enum SortAlgorithm
strong
Enumerator
Default 
SpeculativeTopN 
StreamingTopN 

Definition at line 42 of file RelAlgExecutionUnit.h.

Function Documentation

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

Definition at line 1280 of file Execute.cpp.

References RelAlgExecutionUnit::estimator, anonymous_namespace{Execute.cpp}::expr_container_to_string(), RelAlgExecutionUnit::groupby_exprs, i, RelAlgExecutionUnit::input_col_descs, join(), RelAlgExecutionUnit::join_quals, anonymous_namespace{Execute.cpp}::join_type_to_string(), RelAlgExecutionUnit::quals, 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.

1280  {
1281  os << "\n\tTable/Col/Levels: ";
1282  for (const auto& input_col_desc : ra_exe_unit.input_col_descs) {
1283  const auto& scan_desc = input_col_desc->getScanDesc();
1284  os << "(" << scan_desc.getTableId() << ", " << input_col_desc->getColId() << ", "
1285  << scan_desc.getNestLevel() << ") ";
1286  }
1287  if (!ra_exe_unit.simple_quals.empty()) {
1288  os << "\n\tSimple Quals: "
1290  ", ");
1291  }
1292  if (!ra_exe_unit.quals.empty()) {
1293  os << "\n\tQuals: "
1294  << boost::algorithm::join(expr_container_to_string(ra_exe_unit.quals), ", ");
1295  }
1296  if (!ra_exe_unit.join_quals.empty()) {
1297  os << "\n\tJoin Quals: ";
1298  for (size_t i = 0; i < ra_exe_unit.join_quals.size(); i++) {
1299  const auto& join_condition = ra_exe_unit.join_quals[i];
1300  os << "\t\t" << std::to_string(i) << " "
1301  << join_type_to_string(join_condition.type);
1302  os << boost::algorithm::join(expr_container_to_string(join_condition.quals), ", ");
1303  }
1304  }
1305  if (!ra_exe_unit.groupby_exprs.empty()) {
1306  os << "\n\tGroup By: "
1308  ", ");
1309  }
1310  os << "\n\tProjected targets: "
1312  os << "\n\tHas Estimator: " << ::toString(ra_exe_unit.estimator == nullptr);
1313  os << "\n\tSort Info: ";
1314  const auto& sort_info = ra_exe_unit.sort_info;
1315  os << "\n\t Order Entries: "
1316  << boost::algorithm::join(expr_container_to_string(sort_info.order_entries), ", ");
1317  os << "\n\t Algorithm: " << sort_algorithm_to_string(sort_info.algorithm);
1318  os << "\n\t Limit: " << std::to_string(sort_info.limit);
1319  os << "\n\t Offset: " << std::to_string(sort_info.offset);
1320  os << "\n\tScan Limit: " << std::to_string(ra_exe_unit.scan_limit);
1321  os << "\n\tBump Allocator: " << ::toString(ra_exe_unit.use_bump_allocator);
1322  if (ra_exe_unit.union_all) {
1323  os << "\n\tUnion: " << std::string(*ra_exe_unit.union_all ? "UNION ALL" : "UNION");
1324  }
1325  return os;
1326 }
std::vector< Analyzer::Expr * > target_exprs
std::string toString(const ExtArgumentType &sig_type)
const std::optional< bool > union_all
std::string join(T const &container, std::string const &delim)
std::string join_type_to_string(const JoinType type)
Definition: Execute.cpp:1201
const std::list< std::shared_ptr< Analyzer::Expr > > groupby_exprs
std::string to_string(char const *&&v)
const SortInfo sort_info
const JoinQualsPerNestingLevel join_quals
std::vector< std::string > expr_container_to_string(const T &expr_container)
Definition: Execute.cpp:1179
const std::shared_ptr< Analyzer::Estimator > estimator
std::string sort_algorithm_to_string(const SortAlgorithm algorithm)
Definition: Execute.cpp:1214
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:

std::string ra_exec_unit_desc_for_caching ( const RelAlgExecutionUnit ra_exe_unit)

Definition at line 1229 of file Execute.cpp.

References RelAlgExecutionUnit::estimator, RelAlgExecutionUnit::groupby_exprs, i, RelAlgExecutionUnit::input_col_descs, RelAlgExecutionUnit::join_quals, anonymous_namespace{Execute.cpp}::join_type_to_string(), RelAlgExecutionUnit::quals, RelAlgExecutionUnit::scan_limit, RelAlgExecutionUnit::simple_quals, RelAlgExecutionUnit::target_exprs, to_string(), and toString().

Referenced by RelAlgExecutor::executeWorkUnit().

1229  {
1230  // todo(yoonmin): replace a cache key as a DAG representation of a query plan
1231  // instead of ra_exec_unit description if possible
1232  std::ostringstream os;
1233  for (const auto& input_col_desc : ra_exe_unit.input_col_descs) {
1234  const auto& scan_desc = input_col_desc->getScanDesc();
1235  os << scan_desc.getTableId() << "," << input_col_desc->getColId() << ","
1236  << scan_desc.getNestLevel();
1237  }
1238  if (!ra_exe_unit.simple_quals.empty()) {
1239  for (const auto& qual : ra_exe_unit.simple_quals) {
1240  if (qual) {
1241  os << qual->toString() << ",";
1242  }
1243  }
1244  }
1245  if (!ra_exe_unit.quals.empty()) {
1246  for (const auto& qual : ra_exe_unit.quals) {
1247  if (qual) {
1248  os << qual->toString() << ",";
1249  }
1250  }
1251  }
1252  if (!ra_exe_unit.join_quals.empty()) {
1253  for (size_t i = 0; i < ra_exe_unit.join_quals.size(); i++) {
1254  const auto& join_condition = ra_exe_unit.join_quals[i];
1255  os << std::to_string(i) << join_type_to_string(join_condition.type);
1256  for (const auto& qual : join_condition.quals) {
1257  if (qual) {
1258  os << qual->toString() << ",";
1259  }
1260  }
1261  }
1262  }
1263  if (!ra_exe_unit.groupby_exprs.empty()) {
1264  for (const auto& qual : ra_exe_unit.groupby_exprs) {
1265  if (qual) {
1266  os << qual->toString() << ",";
1267  }
1268  }
1269  }
1270  for (const auto& expr : ra_exe_unit.target_exprs) {
1271  if (expr) {
1272  os << expr->toString() << ",";
1273  }
1274  }
1275  os << ::toString(ra_exe_unit.estimator == nullptr);
1276  os << std::to_string(ra_exe_unit.scan_limit);
1277  return os.str();
1278 }
std::vector< Analyzer::Expr * > target_exprs
std::string toString(const ExtArgumentType &sig_type)
std::string join_type_to_string(const JoinType type)
Definition: Execute.cpp:1201
const std::list< std::shared_ptr< Analyzer::Expr > > groupby_exprs
std::string to_string(char const *&&v)
const JoinQualsPerNestingLevel join_quals
const std::shared_ptr< Analyzer::Estimator > estimator
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:

+ Here is the caller graph for this function: