OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{RelAlgAbstractInterpreter.cpp} Namespace Reference

Namespaces

 anonymous_namespace{RelAlgAbstractInterpreter.cpp}
 

Classes

class  RexRebindInputsVisitor
 
class  RANodeIterator
 
class  WindowFunctionDetectionVisitor
 
class  RexWindowFuncReplacementVisitor
 
class  RexInputBackpropagationVisitor
 
class  RelAlgAbstractInterpreter
 

Functions

std::vector< RexInputn_outputs (const RelAlgNode *node, const size_t n)
 
bool isRenamedInput (const RelAlgNode *node, const size_t index, const std::string &new_name)
 
std::set< std::pair< const
RelAlgNode *, int > > 
get_equiv_cols (const RelAlgNode *node, const size_t which_col)
 
unsigned node_id (const rapidjson::Value &ra_node) noexcept
 
std::unique_ptr< RexAbstractInputparse_abstract_input (const rapidjson::Value &expr) noexcept
 
std::unique_ptr< RexLiteralparse_literal (const rapidjson::Value &expr)
 
std::unique_ptr< const RexScalarparse_scalar_expr (const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
std::unique_ptr< const
RexSubQuery
parse_subquery (const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
SQLTypeInfo parse_type (const rapidjson::Value &type_obj)
 
std::vector< std::unique_ptr
< const RexScalar > > 
parse_expr_array (const rapidjson::Value &arr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
SqlWindowFunctionKind parse_window_function_kind (const std::string &name)
 
std::vector< std::unique_ptr
< const RexScalar > > 
parse_window_order_exprs (const rapidjson::Value &arr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
SortDirection parse_sort_direction (const rapidjson::Value &collation)
 
NullSortedPosition parse_nulls_position (const rapidjson::Value &collation)
 
std::vector< SortFieldparse_window_order_collation (const rapidjson::Value &arr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
RexWindowFunctionOperator::RexWindowBound parse_window_bound (const rapidjson::Value &window_bound_obj, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
std::unique_ptr< RexOperatorparse_operator (const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
std::unique_ptr< RexCaseparse_case (const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
 
std::vector< std::string > strings_from_json_array (const rapidjson::Value &json_str_arr) noexcept
 
std::vector< size_t > indices_from_json_array (const rapidjson::Value &json_idx_arr) noexcept
 
std::string json_node_to_string (const rapidjson::Value &node) noexcept
 
std::unique_ptr< const RexAggparse_aggregate_expr (const rapidjson::Value &expr)
 
JoinType to_join_type (const std::string &join_type_name)
 
std::unique_ptr< const RexScalardisambiguate_rex (const RexScalar *, const RANodeOutput &)
 
std::unique_ptr< const
RexOperator
disambiguate_operator (const RexOperator *rex_operator, const RANodeOutput &ra_output) noexcept
 
std::unique_ptr< const RexCasedisambiguate_case (const RexCase *rex_case, const RANodeOutput &ra_output)
 
void bind_project_to_input (RelProject *project_node, const RANodeOutput &input) noexcept
 
void bind_table_func_to_input (RelTableFunction *table_func_node, const RANodeOutput &input) noexcept
 
void bind_inputs (const std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept
 
void mark_nops (const std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept
 
void create_compound (std::vector< std::shared_ptr< RelAlgNode >> &nodes, const std::vector< size_t > &pattern) noexcept
 
void coalesce_nodes (std::vector< std::shared_ptr< RelAlgNode >> &nodes, const std::vector< const RelAlgNode * > &left_deep_joins)
 
void separate_window_function_expressions (std::vector< std::shared_ptr< RelAlgNode >> &nodes)
 
int64_t get_int_literal_field (const rapidjson::Value &obj, const char field[], const int64_t default_val) noexcept
 
void check_empty_inputs_field (const rapidjson::Value &node) noexcept
 
std::shared_ptr< const RelAlgNodera_interpret (const rapidjson::Value &query_ast, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor, const RenderQueryOptions *render_opts)
 

Variables

const unsigned FIRST_RA_NODE_ID = 1
 

Function Documentation

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::bind_inputs ( const std::vector< std::shared_ptr< RelAlgNode >> &  nodes)
noexcept

Definition at line 964 of file RelAlgAbstractInterpreter.cpp.

References bind_project_to_input(), bind_table_func_to_input(), CHECK_EQ, disambiguate_rex(), and get_node_output().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::run().

964  {
965  for (auto ra_node : nodes) {
966  const auto filter_node = std::dynamic_pointer_cast<RelFilter>(ra_node);
967  if (filter_node) {
968  CHECK_EQ(size_t(1), filter_node->inputCount());
969  auto disambiguated_condition = disambiguate_rex(
970  filter_node->getCondition(), get_node_output(filter_node->getInput(0)));
971  filter_node->setCondition(disambiguated_condition);
972  continue;
973  }
974  const auto join_node = std::dynamic_pointer_cast<RelJoin>(ra_node);
975  if (join_node) {
976  CHECK_EQ(size_t(2), join_node->inputCount());
977  auto disambiguated_condition =
978  disambiguate_rex(join_node->getCondition(), get_node_output(join_node.get()));
979  join_node->setCondition(disambiguated_condition);
980  continue;
981  }
982  const auto project_node = std::dynamic_pointer_cast<RelProject>(ra_node);
983  if (project_node) {
984  bind_project_to_input(project_node.get(),
985  get_node_output(project_node->getInput(0)));
986  continue;
987  }
988  const auto table_func_node = std::dynamic_pointer_cast<RelTableFunction>(ra_node);
989  if (table_func_node) {
990  bind_table_func_to_input(table_func_node.get(),
991  get_node_output(table_func_node->getInput(0)));
992  }
993  }
994 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
void bind_project_to_input(RelProject *project_node, const RANodeOutput &input) noexcept
std::unique_ptr< const RexScalar > disambiguate_rex(const RexScalar *, const RANodeOutput &)
void bind_table_func_to_input(RelTableFunction *table_func_node, const RANodeOutput &input) noexcept
RANodeOutput get_node_output(const RelAlgNode *ra_node)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::bind_project_to_input ( RelProject project_node,
const RANodeOutput input 
)
noexcept

Definition at line 935 of file RelAlgAbstractInterpreter.cpp.

References CHECK_EQ, and disambiguate_rex().

Referenced by bind_inputs(), and create_compound().

935  {
936  CHECK_EQ(size_t(1), project_node->inputCount());
937  std::vector<std::unique_ptr<const RexScalar>> disambiguated_exprs;
938  for (size_t i = 0; i < project_node->size(); ++i) {
939  const auto projected_expr = project_node->getProjectAt(i);
940  if (dynamic_cast<const RexSubQuery*>(projected_expr)) {
941  disambiguated_exprs.emplace_back(project_node->getProjectAtAndRelease(i));
942  } else {
943  disambiguated_exprs.emplace_back(disambiguate_rex(projected_expr, input));
944  }
945  }
946  project_node->setExpressions(disambiguated_exprs);
947 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
size_t size() const override
void setExpressions(std::vector< std::unique_ptr< const RexScalar >> &exprs) const
std::unique_ptr< const RexScalar > disambiguate_rex(const RexScalar *, const RANodeOutput &)
const RexScalar * getProjectAtAndRelease(const size_t idx) const
const RexScalar * getProjectAt(const size_t idx) const
const size_t inputCount() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::bind_table_func_to_input ( RelTableFunction table_func_node,
const RANodeOutput input 
)
noexcept

Definition at line 949 of file RelAlgAbstractInterpreter.cpp.

References CHECK_EQ, and disambiguate_rex().

Referenced by bind_inputs().

950  {
951  CHECK_EQ(size_t(1), table_func_node->inputCount());
952  std::vector<std::unique_ptr<const RexScalar>> disambiguated_exprs;
953  for (size_t i = 0; i < table_func_node->getTableFuncInputsSize(); ++i) {
954  const auto target_expr = table_func_node->getTableFuncInputAt(i);
955  if (dynamic_cast<const RexSubQuery*>(target_expr)) {
956  disambiguated_exprs.emplace_back(table_func_node->getTableFuncInputAtAndRelease(i));
957  } else {
958  disambiguated_exprs.emplace_back(disambiguate_rex(target_expr, input));
959  }
960  }
961  table_func_node->setTableFuncInputs(disambiguated_exprs);
962 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
const RexScalar * getTableFuncInputAtAndRelease(const size_t idx)
std::unique_ptr< const RexScalar > disambiguate_rex(const RexScalar *, const RANodeOutput &)
size_t getTableFuncInputsSize() const
void setTableFuncInputs(std::vector< std::unique_ptr< const RexScalar >> &exprs)
const RexScalar * getTableFuncInputAt(const size_t idx) const
const size_t inputCount() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::check_empty_inputs_field ( const rapidjson::Value &  node)
noexcept

Definition at line 1775 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), and field().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchTableScan().

1775  {
1776  const auto& inputs_json = field(node, "inputs");
1777  CHECK(inputs_json.IsArray() && !inputs_json.Size());
1778 }
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
CHECK(cgen_state)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::coalesce_nodes ( std::vector< std::shared_ptr< RelAlgNode >> &  nodes,
const std::vector< const RelAlgNode * > &  left_deep_joins 
)

Definition at line 1366 of file RelAlgAbstractInterpreter.cpp.

References anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RANodeIterator::allVisited(), CHECK(), CHECK_GE, create_compound(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::anonymous_namespace{RelAlgAbstractInterpreter.cpp}::input_can_be_coalesced(), and anonymous_namespace{RelAlgAbstractInterpreter.cpp}::anonymous_namespace{RelAlgAbstractInterpreter.cpp}::project_has_window_function_input().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::run().

1367  {
1368  enum class CoalesceState { Initial, Filter, FirstProject, Aggregate };
1369  std::vector<size_t> crt_pattern;
1370  CoalesceState crt_state{CoalesceState::Initial};
1371 
1372  auto reset_state = [&crt_pattern, &crt_state]() {
1373  crt_state = CoalesceState::Initial;
1374  decltype(crt_pattern)().swap(crt_pattern);
1375  };
1376 
1377  for (RANodeIterator nodeIt(nodes); !nodeIt.allVisited();) {
1378  const auto ra_node = nodeIt != nodes.end() ? *nodeIt : nullptr;
1379  switch (crt_state) {
1380  case CoalesceState::Initial: {
1381  if (std::dynamic_pointer_cast<const RelFilter>(ra_node) &&
1382  std::find(left_deep_joins.begin(), left_deep_joins.end(), ra_node.get()) ==
1383  left_deep_joins.end()) {
1384  crt_pattern.push_back(size_t(nodeIt));
1385  crt_state = CoalesceState::Filter;
1386  nodeIt.advance(RANodeIterator::AdvancingMode::DUChain);
1387  } else if (std::dynamic_pointer_cast<const RelProject>(ra_node)) {
1388  crt_pattern.push_back(size_t(nodeIt));
1389  crt_state = CoalesceState::FirstProject;
1390  nodeIt.advance(RANodeIterator::AdvancingMode::DUChain);
1391  } else {
1392  nodeIt.advance(RANodeIterator::AdvancingMode::InOrder);
1393  }
1394  break;
1395  }
1396  case CoalesceState::Filter: {
1397  if (auto project_node = std::dynamic_pointer_cast<const RelProject>(ra_node)) {
1398  if (project_has_window_function_input(project_node.get())) {
1399  reset_state();
1400  break;
1401  }
1402  crt_pattern.push_back(size_t(nodeIt));
1403  crt_state = CoalesceState::FirstProject;
1404  nodeIt.advance(RANodeIterator::AdvancingMode::DUChain);
1405  } else {
1406  reset_state();
1407  }
1408  break;
1409  }
1410  case CoalesceState::FirstProject: {
1411  if (std::dynamic_pointer_cast<const RelAggregate>(ra_node)) {
1412  crt_pattern.push_back(size_t(nodeIt));
1413  crt_state = CoalesceState::Aggregate;
1414  nodeIt.advance(RANodeIterator::AdvancingMode::DUChain);
1415  } else {
1416  if (crt_pattern.size() >= 2) {
1417  create_compound(nodes, crt_pattern);
1418  }
1419  reset_state();
1420  }
1421  break;
1422  }
1423  case CoalesceState::Aggregate: {
1424  if (auto project_node = std::dynamic_pointer_cast<const RelProject>(ra_node)) {
1425  // TODO(adb): overloading the simple project terminology again here
1426  bool is_simple_project{true};
1427  for (size_t i = 0; i < project_node->size(); i++) {
1428  const auto scalar_rex = project_node->getProjectAt(i);
1429  // If the top level scalar rex is an input node, we can bypass the visitor
1430  if (auto input_rex = dynamic_cast<const RexInput*>(scalar_rex)) {
1432  input_rex->getSourceNode(), input_rex->getIndex(), true)) {
1433  is_simple_project = false;
1434  break;
1435  }
1436  continue;
1437  }
1438  CoalesceSecondaryProjectVisitor visitor;
1439  if (!visitor.visit(project_node->getProjectAt(i))) {
1440  is_simple_project = false;
1441  break;
1442  }
1443  }
1444  if (is_simple_project) {
1445  crt_pattern.push_back(size_t(nodeIt));
1446  nodeIt.advance(RANodeIterator::AdvancingMode::InOrder);
1447  }
1448  }
1449  CHECK_GE(crt_pattern.size(), size_t(2));
1450  create_compound(nodes, crt_pattern);
1451  reset_state();
1452  break;
1453  }
1454  default:
1455  CHECK(false);
1456  }
1457  }
1458  if (crt_state == CoalesceState::FirstProject || crt_state == CoalesceState::Aggregate) {
1459  if (crt_pattern.size() >= 2) {
1460  create_compound(nodes, crt_pattern);
1461  }
1462  CHECK(!crt_pattern.empty());
1463  }
1464 }
#define CHECK_GE(x, y)
Definition: Logger.h:203
CHECK(cgen_state)
void create_compound(std::vector< std::shared_ptr< RelAlgNode >> &nodes, const std::vector< size_t > &pattern) noexcept
bool input_can_be_coalesced(const RelAlgNode *parent_node, const size_t index, const bool first_rex_is_input)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::create_compound ( std::vector< std::shared_ptr< RelAlgNode >> &  nodes,
const std::vector< size_t > &  pattern 
)
noexcept

Definition at line 1056 of file RelAlgAbstractInterpreter.cpp.

References bind_project_to_input(), CHECK(), CHECK_EQ, CHECK_GE, CHECK_LE, CHECK_LT, get_node_output(), RelProject::getFields(), anonymous_namespace{RelAlgExecutor.cpp}::is_agg(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::anonymous_namespace{RelAlgAbstractInterpreter.cpp}::reproject_targets(), and run_benchmark_import::result.

Referenced by coalesce_nodes().

1057  {
1058  CHECK_GE(pattern.size(), size_t(2));
1059  CHECK_LE(pattern.size(), size_t(4));
1060 
1061  std::unique_ptr<const RexScalar> filter_rex;
1062  std::vector<std::unique_ptr<const RexScalar>> scalar_sources;
1063  size_t groupby_count{0};
1064  std::vector<std::string> fields;
1065  std::vector<const RexAgg*> agg_exprs;
1066  std::vector<const Rex*> target_exprs;
1067  bool first_project{true};
1068  bool is_agg{false};
1069  RelAlgNode* last_node{nullptr};
1070 
1071  std::shared_ptr<ModifyManipulationTarget> manipulation_target;
1072 
1073  for (const auto node_idx : pattern) {
1074  const auto ra_node = nodes[node_idx];
1075  const auto ra_filter = std::dynamic_pointer_cast<RelFilter>(ra_node);
1076  if (ra_filter) {
1077  CHECK(!filter_rex);
1078  filter_rex.reset(ra_filter->getAndReleaseCondition());
1079  CHECK(filter_rex);
1080  last_node = ra_node.get();
1081  continue;
1082  }
1083  const auto ra_project = std::dynamic_pointer_cast<RelProject>(ra_node);
1084  if (ra_project) {
1085  fields = ra_project->getFields();
1086  manipulation_target = ra_project;
1087 
1088  if (first_project) {
1089  CHECK_EQ(size_t(1), ra_project->inputCount());
1090  // Rebind the input of the project to the input of the filter itself
1091  // since we know that we'll evaluate the filter on the fly, with no
1092  // intermediate buffer.
1093  const auto filter_input = dynamic_cast<const RelFilter*>(ra_project->getInput(0));
1094  if (filter_input) {
1095  CHECK_EQ(size_t(1), filter_input->inputCount());
1096  bind_project_to_input(ra_project.get(),
1097  get_node_output(filter_input->getInput(0)));
1098  }
1099  scalar_sources = ra_project->getExpressionsAndRelease();
1100  for (const auto& scalar_expr : scalar_sources) {
1101  target_exprs.push_back(scalar_expr.get());
1102  }
1103  first_project = false;
1104  } else {
1105  if (ra_project->isSimple()) {
1106  target_exprs = reproject_targets(ra_project.get(), target_exprs);
1107  } else {
1108  // TODO(adb): This is essentially a more general case of simple project, we
1109  // could likely merge the two
1110  std::vector<const Rex*> result;
1111  RexInputReplacementVisitor visitor(last_node, scalar_sources);
1112  for (size_t i = 0; i < ra_project->size(); ++i) {
1113  const auto rex = ra_project->getProjectAt(i);
1114  if (auto rex_input = dynamic_cast<const RexInput*>(rex)) {
1115  const auto index = rex_input->getIndex();
1116  CHECK_LT(index, target_exprs.size());
1117  result.push_back(target_exprs[index]);
1118  } else {
1119  scalar_sources.push_back(visitor.visit(rex));
1120  result.push_back(scalar_sources.back().get());
1121  }
1122  }
1123  target_exprs = result;
1124  }
1125  }
1126  last_node = ra_node.get();
1127  continue;
1128  }
1129  const auto ra_aggregate = std::dynamic_pointer_cast<RelAggregate>(ra_node);
1130  if (ra_aggregate) {
1131  is_agg = true;
1132  fields = ra_aggregate->getFields();
1133  agg_exprs = ra_aggregate->getAggregatesAndRelease();
1134  groupby_count = ra_aggregate->getGroupByCount();
1135  decltype(target_exprs){}.swap(target_exprs);
1136  CHECK_LE(groupby_count, scalar_sources.size());
1137  for (size_t group_idx = 0; group_idx < groupby_count; ++group_idx) {
1138  const auto rex_ref = new RexRef(group_idx + 1);
1139  target_exprs.push_back(rex_ref);
1140  scalar_sources.emplace_back(rex_ref);
1141  }
1142  for (const auto rex_agg : agg_exprs) {
1143  target_exprs.push_back(rex_agg);
1144  }
1145  last_node = ra_node.get();
1146  continue;
1147  }
1148  }
1149 
1150  auto compound_node =
1151  std::make_shared<RelCompound>(filter_rex,
1152  target_exprs,
1153  groupby_count,
1154  agg_exprs,
1155  fields,
1156  scalar_sources,
1157  is_agg,
1158  manipulation_target->isUpdateViaSelect(),
1159  manipulation_target->isDeleteViaSelect(),
1160  manipulation_target->isVarlenUpdateRequired(),
1161  manipulation_target->getModifiedTableDescriptor(),
1162  manipulation_target->getTargetColumns());
1163  auto old_node = nodes[pattern.back()];
1164  nodes[pattern.back()] = compound_node;
1165  auto first_node = nodes[pattern.front()];
1166  CHECK_EQ(size_t(1), first_node->inputCount());
1167  compound_node->addManagedInput(first_node->getAndOwnInput(0));
1168  for (size_t i = 0; i < pattern.size() - 1; ++i) {
1169  nodes[pattern[i]].reset();
1170  }
1171  for (auto node : nodes) {
1172  if (!node) {
1173  continue;
1174  }
1175  node->replaceInput(old_node, compound_node);
1176  }
1177 }
bool is_agg(const Analyzer::Expr *expr)
#define CHECK_EQ(x, y)
Definition: Logger.h:198
void bind_project_to_input(RelProject *project_node, const RANodeOutput &input) noexcept
#define CHECK_GE(x, y)
Definition: Logger.h:203
CHECK(cgen_state)
#define CHECK_LT(x, y)
Definition: Logger.h:200
#define CHECK_LE(x, y)
Definition: Logger.h:201
const std::vector< std::string > & getFields() const
RANodeOutput get_node_output(const RelAlgNode *ra_node)
std::vector< const Rex * > reproject_targets(const RelProject *simple_project, const std::vector< const Rex * > &target_exprs) noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<const RexCase> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::disambiguate_case ( const RexCase rex_case,
const RANodeOutput ra_output 
)

Definition at line 893 of file RelAlgAbstractInterpreter.cpp.

References RexCase::branchCount(), disambiguate_rex(), RexCase::getElse(), RexCase::getThen(), and RexCase::getWhen().

Referenced by disambiguate_rex().

894  {
895  std::vector<
896  std::pair<std::unique_ptr<const RexScalar>, std::unique_ptr<const RexScalar>>>
897  disambiguated_expr_pair_list;
898  for (size_t i = 0; i < rex_case->branchCount(); ++i) {
899  auto disambiguated_when = disambiguate_rex(rex_case->getWhen(i), ra_output);
900  auto disambiguated_then = disambiguate_rex(rex_case->getThen(i), ra_output);
901  disambiguated_expr_pair_list.emplace_back(std::move(disambiguated_when),
902  std::move(disambiguated_then));
903  }
904  std::unique_ptr<const RexScalar> disambiguated_else{
905  disambiguate_rex(rex_case->getElse(), ra_output)};
906  return std::unique_ptr<const RexCase>(
907  new RexCase(disambiguated_expr_pair_list, disambiguated_else));
908 }
const RexScalar * getThen(const size_t idx) const
const RexScalar * getElse() const
const RexScalar * getWhen(const size_t idx) const
std::unique_ptr< const RexScalar > disambiguate_rex(const RexScalar *, const RANodeOutput &)
size_t branchCount() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<const RexOperator> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::disambiguate_operator ( const RexOperator rex_operator,
const RANodeOutput ra_output 
)
noexcept

Definition at line 858 of file RelAlgAbstractInterpreter.cpp.

References disambiguate_rex(), and RexWindowFunctionOperator::getPartitionKeys().

Referenced by disambiguate_rex().

860  {
861  std::vector<std::unique_ptr<const RexScalar>> disambiguated_operands;
862  for (size_t i = 0; i < rex_operator->size(); ++i) {
863  auto operand = rex_operator->getOperand(i);
864  if (dynamic_cast<const RexSubQuery*>(operand)) {
865  disambiguated_operands.emplace_back(rex_operator->getOperandAndRelease(i));
866  } else {
867  disambiguated_operands.emplace_back(disambiguate_rex(operand, ra_output));
868  }
869  }
870  const auto rex_window_function_operator =
871  dynamic_cast<const RexWindowFunctionOperator*>(rex_operator);
872  if (rex_window_function_operator) {
873  const auto& partition_keys = rex_window_function_operator->getPartitionKeys();
874  std::vector<std::unique_ptr<const RexScalar>> disambiguated_partition_keys;
875  for (const auto& partition_key : partition_keys) {
876  disambiguated_partition_keys.emplace_back(
877  disambiguate_rex(partition_key.get(), ra_output));
878  }
879  std::vector<std::unique_ptr<const RexScalar>> disambiguated_order_keys;
880  const auto& order_keys = rex_window_function_operator->getOrderKeys();
881  for (const auto& order_key : order_keys) {
882  disambiguated_order_keys.emplace_back(disambiguate_rex(order_key.get(), ra_output));
883  }
884  return rex_window_function_operator->disambiguatedOperands(
885  disambiguated_operands,
886  disambiguated_partition_keys,
887  disambiguated_order_keys,
888  rex_window_function_operator->getCollation());
889  }
890  return rex_operator->getDisambiguated(disambiguated_operands);
891 }
size_t size() const
const RexScalar * getOperand(const size_t idx) const
const RexScalar * getOperandAndRelease(const size_t idx) const
virtual std::unique_ptr< const RexOperator > getDisambiguated(std::vector< std::unique_ptr< const RexScalar >> &operands) const
std::unique_ptr< const RexScalar > disambiguate_rex(const RexScalar *, const RANodeOutput &)
const ConstRexScalarPtrVector & getPartitionKeys() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr< const RexScalar > anonymous_namespace{RelAlgAbstractInterpreter.cpp}::disambiguate_rex ( const RexScalar rex_scalar,
const RANodeOutput ra_output 
)

Definition at line 914 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), CHECK_LT, disambiguate_case(), and disambiguate_operator().

Referenced by bind_inputs(), bind_project_to_input(), bind_table_func_to_input(), disambiguate_case(), and disambiguate_operator().

915  {
916  const auto rex_abstract_input = dynamic_cast<const RexAbstractInput*>(rex_scalar);
917  if (rex_abstract_input) {
918  CHECK_LT(static_cast<size_t>(rex_abstract_input->getIndex()), ra_output.size());
919  return std::unique_ptr<const RexInput>(
920  new RexInput(ra_output[rex_abstract_input->getIndex()]));
921  }
922  const auto rex_operator = dynamic_cast<const RexOperator*>(rex_scalar);
923  if (rex_operator) {
924  return disambiguate_operator(rex_operator, ra_output);
925  }
926  const auto rex_case = dynamic_cast<const RexCase*>(rex_scalar);
927  if (rex_case) {
928  return disambiguate_case(rex_case, ra_output);
929  }
930  const auto rex_literal = dynamic_cast<const RexLiteral*>(rex_scalar);
931  CHECK(rex_literal);
932  return std::unique_ptr<const RexLiteral>(new RexLiteral(*rex_literal));
933 }
std::unique_ptr< const RexCase > disambiguate_case(const RexCase *rex_case, const RANodeOutput &ra_output)
CHECK(cgen_state)
#define CHECK_LT(x, y)
Definition: Logger.h:200
std::unique_ptr< const RexOperator > disambiguate_operator(const RexOperator *rex_operator, const RANodeOutput &ra_output) noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::set<std::pair<const RelAlgNode*, int> > anonymous_namespace{RelAlgAbstractInterpreter.cpp}::get_equiv_cols ( const RelAlgNode node,
const size_t  which_col 
)

Definition at line 417 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), and CHECK_EQ.

Referenced by RelSort::hasEquivCollationOf().

418  {
419  std::set<std::pair<const RelAlgNode*, int>> work_set;
420  auto walker = node;
421  auto curr_col = which_col;
422  while (true) {
423  work_set.insert(std::make_pair(walker, curr_col));
424  if (dynamic_cast<const RelScan*>(walker) || dynamic_cast<const RelJoin*>(walker)) {
425  break;
426  }
427  CHECK_EQ(size_t(1), walker->inputCount());
428  auto only_source = walker->getInput(0);
429  if (auto project = dynamic_cast<const RelProject*>(walker)) {
430  if (auto input = dynamic_cast<const RexInput*>(project->getProjectAt(curr_col))) {
431  const auto join_source = dynamic_cast<const RelJoin*>(only_source);
432  if (join_source) {
433  CHECK_EQ(size_t(2), join_source->inputCount());
434  auto lhs = join_source->getInput(0);
435  CHECK((input->getIndex() < lhs->size() && lhs == input->getSourceNode()) ||
436  join_source->getInput(1) == input->getSourceNode());
437  } else {
438  CHECK_EQ(input->getSourceNode(), only_source);
439  }
440  curr_col = input->getIndex();
441  } else {
442  break;
443  }
444  } else if (auto aggregate = dynamic_cast<const RelAggregate*>(walker)) {
445  if (curr_col >= aggregate->getGroupByCount()) {
446  break;
447  }
448  }
449  walker = only_source;
450  }
451  return work_set;
452 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
CHECK(cgen_state)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t anonymous_namespace{RelAlgAbstractInterpreter.cpp}::get_int_literal_field ( const rapidjson::Value &  obj,
const char  field[],
const int64_t  default_val 
)
noexcept

Definition at line 1761 of file RelAlgAbstractInterpreter.cpp.

References CHECK_EQ, field(), kDECIMAL, and anonymous_namespace{CalciteAdapter.cpp}::parse_literal().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchSort().

1763  {
1764  const auto it = obj.FindMember(field);
1765  if (it == obj.MemberEnd()) {
1766  return default_val;
1767  }
1768  std::unique_ptr<RexLiteral> lit(parse_literal(it->value));
1769  CHECK_EQ(kDECIMAL, lit->getType());
1770  CHECK_EQ(unsigned(0), lit->getScale());
1771  CHECK_EQ(unsigned(0), lit->getTypeScale());
1772  return lit->getVal<int64_t>();
1773 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
std::tuple< const rapidjson::Value *, SQLTypeInfo, SQLTypeInfo > parse_literal(const rapidjson::Value &expr)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<size_t> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::indices_from_json_array ( const rapidjson::Value &  json_idx_arr)
noexcept

Definition at line 791 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), and CHECK_GE.

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchAggregate(), and parse_aggregate_expr().

792  {
793  CHECK(json_idx_arr.IsArray());
794  std::vector<size_t> indices;
795  for (auto json_idx_arr_it = json_idx_arr.Begin(); json_idx_arr_it != json_idx_arr.End();
796  ++json_idx_arr_it) {
797  CHECK(json_idx_arr_it->IsInt());
798  CHECK_GE(json_idx_arr_it->GetInt(), 0);
799  indices.emplace_back(json_idx_arr_it->GetInt());
800  }
801  return indices;
802 }
#define CHECK_GE(x, y)
Definition: Logger.h:203
CHECK(cgen_state)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{RelAlgAbstractInterpreter.cpp}::isRenamedInput ( const RelAlgNode node,
const size_t  index,
const std::string &  new_name 
)

Definition at line 206 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), CHECK_EQ, CHECK_GE, CHECK_LT, RelAlgNode::getInput(), join(), and RelAlgNode::size().

Referenced by RelProject::isRenaming().

208  {
209  CHECK_LT(index, node->size());
210  if (auto join = dynamic_cast<const RelJoin*>(node)) {
211  CHECK_EQ(size_t(2), join->inputCount());
212  const auto lhs_size = join->getInput(0)->size();
213  if (index < lhs_size) {
214  return isRenamedInput(join->getInput(0), index, new_name);
215  }
216  CHECK_GE(index, lhs_size);
217  return isRenamedInput(join->getInput(1), index - lhs_size, new_name);
218  }
219 
220  if (auto scan = dynamic_cast<const RelScan*>(node)) {
221  return new_name != scan->getFieldName(index);
222  }
223 
224  if (auto aggregate = dynamic_cast<const RelAggregate*>(node)) {
225  return new_name != aggregate->getFieldName(index);
226  }
227 
228  if (auto project = dynamic_cast<const RelProject*>(node)) {
229  return new_name != project->getFieldName(index);
230  }
231 
232  if (auto table_func = dynamic_cast<const RelTableFunction*>(node)) {
233  return new_name != table_func->getFieldName(index);
234  }
235 
236  if (auto logical_values = dynamic_cast<const RelLogicalValues*>(node)) {
237  const auto& tuple_type = logical_values->getTupleType();
238  CHECK_LT(index, tuple_type.size());
239  return new_name != tuple_type[index].get_resname();
240  }
241 
242  CHECK(dynamic_cast<const RelSort*>(node) || dynamic_cast<const RelFilter*>(node));
243  return isRenamedInput(node->getInput(0), index, new_name);
244 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
std::string join(T const &container, std::string const &delim)
#define CHECK_GE(x, y)
Definition: Logger.h:203
CHECK(cgen_state)
bool isRenamedInput(const RelAlgNode *node, const size_t index, const std::string &new_name)
const RelAlgNode * getInput(const size_t idx) const
#define CHECK_LT(x, y)
Definition: Logger.h:200
virtual size_t size() const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{RelAlgAbstractInterpreter.cpp}::json_node_to_string ( const rapidjson::Value &  node)
noexcept

Definition at line 804 of file RelAlgAbstractInterpreter.cpp.

Referenced by parse_scalar_expr().

804  {
805  rapidjson::StringBuffer buffer;
806  rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
807  node.Accept(writer);
808  return buffer.GetString();
809 }

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::mark_nops ( const std::vector< std::shared_ptr< RelAlgNode >> &  nodes)
noexcept

Definition at line 996 of file RelAlgAbstractInterpreter.cpp.

References CHECK_EQ, and RelAlgNode::markAsNop().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::run().

996  {
997  for (auto node : nodes) {
998  const auto agg_node = std::dynamic_pointer_cast<RelAggregate>(node);
999  if (!agg_node || agg_node->getAggExprsCount()) {
1000  continue;
1001  }
1002  CHECK_EQ(size_t(1), node->inputCount());
1003  const auto agg_input_node = dynamic_cast<const RelAggregate*>(node->getInput(0));
1004  if (agg_input_node && !agg_input_node->getAggExprsCount() &&
1005  agg_node->getGroupByCount() == agg_input_node->getGroupByCount()) {
1006  agg_node->markAsNop();
1007  }
1008  }
1009 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<RexInput> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::n_outputs ( const RelAlgNode node,
const size_t  n 
)

Definition at line 84 of file RelAlgAbstractInterpreter.cpp.

Referenced by get_node_output().

84  {
85  std::vector<RexInput> outputs;
86  for (size_t i = 0; i < n; ++i) {
87  outputs.emplace_back(node, i);
88  }
89  return outputs;
90 }

+ Here is the caller graph for this function:

unsigned anonymous_namespace{RelAlgAbstractInterpreter.cpp}::node_id ( const rapidjson::Value &  ra_node)
noexcept

Definition at line 487 of file RelAlgAbstractInterpreter.cpp.

References field(), and json_str().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchFilter(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchNodes(), and anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::prev().

487  {
488  const auto& id = field(ra_node, "id");
489  return std::stoi(json_str(id));
490 }
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<RexAbstractInput> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_abstract_input ( const rapidjson::Value &  expr)
noexcept

Definition at line 496 of file RelAlgAbstractInterpreter.cpp.

References field(), and json_i64().

Referenced by parse_scalar_expr().

497  {
498  const auto& input = field(expr, "input");
499  return std::unique_ptr<RexAbstractInput>(new RexAbstractInput(json_i64(input)));
500 }
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
const int64_t json_i64(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<const RexAgg> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_aggregate_expr ( const rapidjson::Value &  expr)

Definition at line 811 of file RelAlgAbstractInterpreter.cpp.

References field(), indices_from_json_array(), json_bool(), json_str(), kAPPROX_COUNT_DISTINCT, parse_type(), and to_agg_kind().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchAggregate().

811  {
812  const auto agg = to_agg_kind(json_str(field(expr, "agg")));
813  const auto distinct = json_bool(field(expr, "distinct"));
814  const auto agg_ti = parse_type(field(expr, "type"));
815  const auto operands = indices_from_json_array(field(expr, "operands"));
816  if (operands.size() > 1 && (operands.size() != 2 || agg != kAPPROX_COUNT_DISTINCT)) {
817  throw QueryNotSupported("Multiple arguments for aggregates aren't supported");
818  }
819  return std::unique_ptr<const RexAgg>(new RexAgg(agg, distinct, agg_ti, operands));
820 }
SQLAgg to_agg_kind(const std::string &agg_name)
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:49
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
std::vector< size_t > indices_from_json_array(const rapidjson::Value &json_idx_arr) noexcept
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
SQLTypeInfo parse_type(const rapidjson::Value &type_obj)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<RexCase> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_case ( const rapidjson::Value &  expr,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 757 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), CHECK_GE, field(), and parse_scalar_expr().

Referenced by parse_scalar_expr().

759  {
760  const auto& operands = field(expr, "operands");
761  CHECK(operands.IsArray());
762  CHECK_GE(operands.Size(), unsigned(2));
763  std::unique_ptr<const RexScalar> else_expr;
764  std::vector<
765  std::pair<std::unique_ptr<const RexScalar>, std::unique_ptr<const RexScalar>>>
766  expr_pair_list;
767  for (auto operands_it = operands.Begin(); operands_it != operands.End();) {
768  auto when_expr = parse_scalar_expr(*operands_it++, cat, ra_executor);
769  if (operands_it == operands.End()) {
770  else_expr = std::move(when_expr);
771  break;
772  }
773  auto then_expr = parse_scalar_expr(*operands_it++, cat, ra_executor);
774  expr_pair_list.emplace_back(std::move(when_expr), std::move(then_expr));
775  }
776  return std::unique_ptr<RexCase>(new RexCase(expr_pair_list, else_expr));
777 }
#define CHECK_GE(x, y)
Definition: Logger.h:203
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
std::unique_ptr< const RexScalar > parse_scalar_expr(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
CHECK(cgen_state)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<std::unique_ptr<const RexScalar> > anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_expr_array ( const rapidjson::Value &  arr,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 593 of file RelAlgAbstractInterpreter.cpp.

References parse_scalar_expr().

Referenced by parse_operator().

596  {
597  std::vector<std::unique_ptr<const RexScalar>> exprs;
598  for (auto it = arr.Begin(); it != arr.End(); ++it) {
599  exprs.emplace_back(parse_scalar_expr(*it, cat, ra_executor));
600  }
601  return exprs;
602 }
std::unique_ptr< const RexScalar > parse_scalar_expr(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<RexLiteral> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_literal ( const rapidjson::Value &  expr)

Definition at line 502 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), field(), json_bool(), json_double(), json_i64(), json_str(), kBOOLEAN, kDATE, kDECIMAL, kDOUBLE, kINTERVAL_DAY_TIME, kINTERVAL_YEAR_MONTH, kNULLT, kTEXT, kTIME, kTIMESTAMP, to_sql_type(), and run_benchmark_import::type.

502  {
503  CHECK(expr.IsObject());
504  const auto& literal = field(expr, "literal");
505  const auto type = to_sql_type(json_str(field(expr, "type")));
506  const auto target_type = to_sql_type(json_str(field(expr, "target_type")));
507  const auto scale = json_i64(field(expr, "scale"));
508  const auto precision = json_i64(field(expr, "precision"));
509  const auto type_scale = json_i64(field(expr, "type_scale"));
510  const auto type_precision = json_i64(field(expr, "type_precision"));
511  switch (type) {
512  case kDECIMAL:
513  case kINTERVAL_DAY_TIME:
515  case kTIME:
516  case kTIMESTAMP:
517  case kDATE:
518  return std::unique_ptr<RexLiteral>(new RexLiteral(json_i64(literal),
519  type,
520  target_type,
521  scale,
522  precision,
523  type_scale,
524  type_precision));
525  case kDOUBLE: {
526  if (literal.IsDouble()) {
527  return std::unique_ptr<RexLiteral>(new RexLiteral(json_double(literal),
528  type,
529  target_type,
530  scale,
531  precision,
532  type_scale,
533  type_precision));
534  }
535  CHECK(literal.IsInt64());
536  return std::unique_ptr<RexLiteral>(
537  new RexLiteral(static_cast<double>(json_i64(literal)),
538  type,
539  target_type,
540  scale,
541  precision,
542  type_scale,
543  type_precision));
544  }
545  case kTEXT:
546  return std::unique_ptr<RexLiteral>(new RexLiteral(json_str(literal),
547  type,
548  target_type,
549  scale,
550  precision,
551  type_scale,
552  type_precision));
553  case kBOOLEAN:
554  return std::unique_ptr<RexLiteral>(new RexLiteral(json_bool(literal),
555  type,
556  target_type,
557  scale,
558  precision,
559  type_scale,
560  type_precision));
561  case kNULLT:
562  return std::unique_ptr<RexLiteral>(new RexLiteral(target_type));
563  default:
564  CHECK(false);
565  }
566  CHECK(false);
567  return nullptr;
568 }
SQLTypes to_sql_type(const std::string &type_name)
Definition: sqltypes.h:52
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:49
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
CHECK(cgen_state)
const int64_t json_i64(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:39
const double json_double(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:54
Definition: sqltypes.h:55
Definition: sqltypes.h:56

+ Here is the call graph for this function:

NullSortedPosition anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_nulls_position ( const rapidjson::Value &  collation)

Definition at line 673 of file RelAlgAbstractInterpreter.cpp.

References field(), First, json_str(), and Last.

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchSort(), and parse_window_order_collation().

673  {
674  return json_str(field(collation, "nulls")) == std::string("FIRST")
677 }
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<RexOperator> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_operator ( const rapidjson::Value &  expr,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 712 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), field(), json_bool(), json_str(), kFUNCTION, kIN, parse_expr_array(), parse_subquery(), parse_type(), parse_window_bound(), parse_window_function_kind(), parse_window_order_collation(), parse_window_order_exprs(), and to_sql_op().

Referenced by parse_scalar_expr().

714  {
715  const auto op_name = json_str(field(expr, "op"));
716  const bool is_quantifier =
717  op_name == std::string("PG_ANY") || op_name == std::string("PG_ALL");
718  const auto op = is_quantifier ? kFUNCTION : to_sql_op(op_name);
719  const auto& operators_json_arr = field(expr, "operands");
720  CHECK(operators_json_arr.IsArray());
721  auto operands = parse_expr_array(operators_json_arr, cat, ra_executor);
722  const auto type_it = expr.FindMember("type");
723  CHECK(type_it != expr.MemberEnd());
724  auto ti = parse_type(type_it->value);
725  if (op == kIN && expr.HasMember("subquery")) {
726  auto subquery = parse_subquery(expr, cat, ra_executor);
727  operands.emplace_back(std::move(subquery));
728  }
729  if (expr.FindMember("partition_keys") != expr.MemberEnd()) {
730  const auto& partition_keys_arr = field(expr, "partition_keys");
731  auto partition_keys = parse_expr_array(partition_keys_arr, cat, ra_executor);
732  const auto& order_keys_arr = field(expr, "order_keys");
733  auto order_keys = parse_window_order_exprs(order_keys_arr, cat, ra_executor);
734  const auto collation = parse_window_order_collation(order_keys_arr, cat, ra_executor);
735  const auto kind = parse_window_function_kind(op_name);
736  const auto lower_bound =
737  parse_window_bound(field(expr, "lower_bound"), cat, ra_executor);
738  const auto upper_bound =
739  parse_window_bound(field(expr, "upper_bound"), cat, ra_executor);
740  bool is_rows = json_bool(field(expr, "is_rows"));
741  ti.set_notnull(false);
742  return std::make_unique<RexWindowFunctionOperator>(kind,
743  operands,
744  partition_keys,
745  order_keys,
746  collation,
747  lower_bound,
748  upper_bound,
749  is_rows,
750  ti);
751  }
752  return std::unique_ptr<RexOperator>(op == kFUNCTION
753  ? new RexFunctionOperator(op_name, operands, ti)
754  : new RexOperator(op, operands, ti));
755 }
std::unique_ptr< const RexSubQuery > parse_subquery(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
std::vector< std::unique_ptr< const RexScalar > > parse_window_order_exprs(const rapidjson::Value &arr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
std::vector< std::unique_ptr< const RexScalar > > parse_expr_array(const rapidjson::Value &arr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:49
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
SqlWindowFunctionKind parse_window_function_kind(const std::string &name)
std::vector< SortField > parse_window_order_collation(const rapidjson::Value &arr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
CHECK(cgen_state)
SQLOps to_sql_op(const std::string &op_str)
RexWindowFunctionOperator::RexWindowBound parse_window_bound(const rapidjson::Value &window_bound_obj, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
SQLTypeInfo parse_type(const rapidjson::Value &type_obj)
Definition: sqldefs.h:53

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr< const RexScalar > anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_scalar_expr ( const rapidjson::Value &  expr,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 822 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), field(), json_node_to_string(), json_str(), parse_abstract_input(), parse_case(), anonymous_namespace{CalciteAdapter.cpp}::parse_literal(), parse_operator(), and parse_subquery().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchFilter(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchJoin(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchProject(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchTableFunction(), parse_case(), parse_expr_array(), parse_window_bound(), and parse_window_order_exprs().

824  {
825  CHECK(expr.IsObject());
826  if (expr.IsObject() && expr.HasMember("input")) {
827  return std::unique_ptr<const RexScalar>(parse_abstract_input(expr));
828  }
829  if (expr.IsObject() && expr.HasMember("literal")) {
830  return std::unique_ptr<const RexScalar>(parse_literal(expr));
831  }
832  if (expr.IsObject() && expr.HasMember("op")) {
833  const auto op_str = json_str(field(expr, "op"));
834  if (op_str == std::string("CASE")) {
835  return std::unique_ptr<const RexScalar>(parse_case(expr, cat, ra_executor));
836  }
837  if (op_str == std::string("$SCALAR_QUERY")) {
838  return std::unique_ptr<const RexScalar>(parse_subquery(expr, cat, ra_executor));
839  }
840  return std::unique_ptr<const RexScalar>(parse_operator(expr, cat, ra_executor));
841  }
842  throw QueryNotSupported("Expression node " + json_node_to_string(expr) +
843  " not supported");
844 }
std::unique_ptr< RexAbstractInput > parse_abstract_input(const rapidjson::Value &expr) noexcept
std::unique_ptr< const RexSubQuery > parse_subquery(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
std::string json_node_to_string(const rapidjson::Value &node) noexcept
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
std::unique_ptr< RexOperator > parse_operator(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
CHECK(cgen_state)
std::unique_ptr< RexCase > parse_case(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
std::tuple< const rapidjson::Value *, SQLTypeInfo, SQLTypeInfo > parse_literal(const rapidjson::Value &expr)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SortDirection anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_sort_direction ( const rapidjson::Value &  collation)

Definition at line 667 of file RelAlgAbstractInterpreter.cpp.

References Ascending, Descending, field(), and json_str().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchSort(), and parse_window_order_collation().

667  {
668  return json_str(field(collation, "direction")) == std::string("DESCENDING")
671 }
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr< const RexSubQuery > anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_subquery ( const rapidjson::Value &  expr,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 2158 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), CHECK_GE, field(), ra_interpret(), and RelAlgExecutor::registerSubquery().

Referenced by parse_operator(), and parse_scalar_expr().

2160  {
2161  const auto& operands = field(expr, "operands");
2162  CHECK(operands.IsArray());
2163  CHECK_GE(operands.Size(), unsigned(0));
2164  const auto& subquery_ast = field(expr, "subquery");
2165 
2166  const auto ra = ra_interpret(subquery_ast, cat, ra_executor, nullptr);
2167  auto subquery = std::make_shared<RexSubQuery>(ra);
2168  ra_executor->registerSubquery(subquery);
2169  return subquery->deepCopy();
2170 }
void registerSubquery(std::shared_ptr< RexSubQuery > subquery) noexcept
#define CHECK_GE(x, y)
Definition: Logger.h:203
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
CHECK(cgen_state)
std::shared_ptr< const RelAlgNode > ra_interpret(const rapidjson::Value &query_ast, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor, const RenderQueryOptions *render_opts)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SQLTypeInfo anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_type ( const rapidjson::Value &  type_obj)

Definition at line 578 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), field(), json_bool(), json_i64(), json_str(), SQLTypeInfoCore< TYPE_FACET_PACK >::set_precision(), SQLTypeInfoCore< TYPE_FACET_PACK >::set_scale(), to_sql_type(), and run_benchmark_import::type.

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchLogicalValues(), parse_aggregate_expr(), and parse_operator().

578  {
579  CHECK(type_obj.IsObject() && type_obj.MemberCount() >= 2);
580  const auto type = to_sql_type(json_str(field(type_obj, "type")));
581  const auto nullable = json_bool(field(type_obj, "nullable"));
582  const auto precision_it = type_obj.FindMember("precision");
583  const int precision =
584  precision_it != type_obj.MemberEnd() ? json_i64(precision_it->value) : 0;
585  const auto scale_it = type_obj.FindMember("scale");
586  const int scale = scale_it != type_obj.MemberEnd() ? json_i64(scale_it->value) : 0;
587  SQLTypeInfo ti(type, !nullable);
588  ti.set_precision(precision);
589  ti.set_scale(scale);
590  return ti;
591 }
SQLTypes to_sql_type(const std::string &type_name)
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:49
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
CHECK(cgen_state)
const int64_t json_i64(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RexWindowFunctionOperator::RexWindowBound anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_window_bound ( const rapidjson::Value &  window_bound_obj,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 692 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), field(), json_bool(), json_i64(), parse_scalar_expr(), and RexWindowFunctionOperator::RexWindowBound::unbounded.

Referenced by parse_operator().

695  {
696  CHECK(window_bound_obj.IsObject());
698  window_bound.unbounded = json_bool(field(window_bound_obj, "unbounded"));
699  window_bound.preceding = json_bool(field(window_bound_obj, "preceding"));
700  window_bound.following = json_bool(field(window_bound_obj, "following"));
701  window_bound.is_current_row = json_bool(field(window_bound_obj, "is_current_row"));
702  const auto& offset_field = field(window_bound_obj, "offset");
703  if (offset_field.IsObject()) {
704  window_bound.offset = parse_scalar_expr(offset_field, cat, ra_executor);
705  } else {
706  CHECK(offset_field.IsNull());
707  }
708  window_bound.order_key = json_i64(field(window_bound_obj, "order_key"));
709  return window_bound;
710 }
const bool json_bool(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:49
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
std::unique_ptr< const RexScalar > parse_scalar_expr(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)
CHECK(cgen_state)
const int64_t json_i64(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SqlWindowFunctionKind anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_window_function_kind ( const std::string &  name)

Definition at line 604 of file RelAlgAbstractInterpreter.cpp.

References AVG, COUNT, CUME_DIST, DENSE_RANK, FIRST_VALUE, LAG, LAST_VALUE, LEAD, MAX, MIN, NTILE, PERCENT_RANK, RANK, ROW_NUMBER, SUM, and SUM_INTERNAL.

Referenced by parse_operator().

604  {
605  if (name == "ROW_NUMBER") {
607  }
608  if (name == "RANK") {
610  }
611  if (name == "DENSE_RANK") {
613  }
614  if (name == "PERCENT_RANK") {
616  }
617  if (name == "CUME_DIST") {
619  }
620  if (name == "NTILE") {
622  }
623  if (name == "LAG") {
625  }
626  if (name == "LEAD") {
628  }
629  if (name == "FIRST_VALUE") {
631  }
632  if (name == "LAST_VALUE") {
634  }
635  if (name == "AVG") {
637  }
638  if (name == "MIN") {
640  }
641  if (name == "MAX") {
643  }
644  if (name == "SUM") {
646  }
647  if (name == "COUNT") {
649  }
650  if (name == "$SUM0") {
652  }
653  throw std::runtime_error("Unsupported window function: " + name);
654 }

+ Here is the caller graph for this function:

std::vector<SortField> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_window_order_collation ( const rapidjson::Value &  arr,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 679 of file RelAlgAbstractInterpreter.cpp.

References parse_nulls_position(), and parse_sort_direction().

Referenced by parse_operator().

681  {
682  std::vector<SortField> collation;
683  size_t field_idx = 0;
684  for (auto it = arr.Begin(); it != arr.End(); ++it, ++field_idx) {
685  const auto sort_dir = parse_sort_direction(*it);
686  const auto null_pos = parse_nulls_position(*it);
687  collation.emplace_back(field_idx, sort_dir, null_pos);
688  }
689  return collation;
690 }
NullSortedPosition parse_nulls_position(const rapidjson::Value &collation)
SortDirection parse_sort_direction(const rapidjson::Value &collation)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<std::unique_ptr<const RexScalar> > anonymous_namespace{RelAlgAbstractInterpreter.cpp}::parse_window_order_exprs ( const rapidjson::Value &  arr,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor 
)

Definition at line 656 of file RelAlgAbstractInterpreter.cpp.

References field(), and parse_scalar_expr().

Referenced by parse_operator().

659  {
660  std::vector<std::unique_ptr<const RexScalar>> exprs;
661  for (auto it = arr.Begin(); it != arr.End(); ++it) {
662  exprs.emplace_back(parse_scalar_expr(field(*it, "field"), cat, ra_executor));
663  }
664  return exprs;
665 }
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
std::unique_ptr< const RexScalar > parse_scalar_expr(const rapidjson::Value &expr, const Catalog_Namespace::Catalog &cat, RelAlgExecutor *ra_executor)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr<const RelAlgNode> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::ra_interpret ( const rapidjson::Value &  query_ast,
const Catalog_Namespace::Catalog cat,
RelAlgExecutor ra_executor,
const RenderQueryOptions render_opts 
)

Definition at line 2150 of file RelAlgAbstractInterpreter.cpp.

References anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::run().

Referenced by deserialize_ra_dag(), and parse_subquery().

2153  {
2154  RelAlgAbstractInterpreter interp(query_ast, cat, ra_executor, render_opts);
2155  return interp.run();
2156 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{RelAlgAbstractInterpreter.cpp}::separate_window_function_expressions ( std::vector< std::shared_ptr< RelAlgNode >> &  nodes)

Detect the presence of window function operators nested inside expressions. Separate the window function operator from the expression, computing the expression as a subsequent step and replacing the window function operator with a RexInput. Also move all input nodes to the newly created project node. In pseudocode: for each rex in project list: detect window function expression if window function expression: copy window function expression replace window function expression in base expression w/ input add base expression to new project node after the current node replace base expression in current project node with the window function expression copy

Definition at line 1655 of file RelAlgAbstractInterpreter.cpp.

References CHECK(), CHECK_EQ, CHECK_LT, RelProject::getProjectAt(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::anonymous_namespace{RelAlgAbstractInterpreter.cpp}::is_window_function_operator(), and RexVisitorBase< T >::visit().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::run().

1656  {
1657  std::list<std::shared_ptr<RelAlgNode>> node_list(nodes.begin(), nodes.end());
1658 
1659  WindowFunctionDetectionVisitor visitor;
1660  for (auto node_itr = node_list.begin(); node_itr != node_list.end(); ++node_itr) {
1661  const auto node = *node_itr;
1662  auto window_func_project_node = std::dynamic_pointer_cast<RelProject>(node);
1663  if (!window_func_project_node) {
1664  continue;
1665  }
1666 
1667  // map scalar expression index in the project node to wiondow function ptr
1668  std::unordered_map<size_t, const RexScalar*> embedded_window_function_expressions;
1669 
1670  // Iterate the target exprs of the project node and check for window function
1671  // expressions. If an embedded expression exists, save it in the
1672  // embedded_window_function_expressions map and split the expression into a window
1673  // function expression and a parent expression in a subsequent project node
1674  for (size_t i = 0; i < window_func_project_node->size(); i++) {
1675  const auto scalar_rex = window_func_project_node->getProjectAt(i);
1676  if (is_window_function_operator(scalar_rex)) {
1677  // top level window function exprs are fine
1678  continue;
1679  }
1680 
1681  if (const auto window_func_rex = visitor.visit(scalar_rex)) {
1682  const auto ret = embedded_window_function_expressions.insert(
1683  std::make_pair(i, window_func_rex));
1684  CHECK(ret.second);
1685  }
1686  }
1687 
1688  if (!embedded_window_function_expressions.empty()) {
1689  std::vector<std::unique_ptr<const RexScalar>> new_scalar_exprs;
1690 
1691  auto window_func_scalar_exprs =
1692  window_func_project_node->getExpressionsAndRelease();
1693  for (size_t rex_idx = 0; rex_idx < window_func_scalar_exprs.size(); ++rex_idx) {
1694  const auto embedded_window_func_expr_pair =
1695  embedded_window_function_expressions.find(rex_idx);
1696  if (embedded_window_func_expr_pair ==
1697  embedded_window_function_expressions.end()) {
1698  new_scalar_exprs.emplace_back(
1699  std::make_unique<const RexInput>(window_func_project_node.get(), rex_idx));
1700  } else {
1701  const auto window_func_rex_idx = embedded_window_func_expr_pair->first;
1702  CHECK_LT(window_func_rex_idx, window_func_scalar_exprs.size());
1703 
1704  const auto& window_func_rex = embedded_window_func_expr_pair->second;
1705 
1706  RexDeepCopyVisitor copier;
1707  auto window_func_rex_copy = copier.visit(window_func_rex);
1708 
1709  auto window_func_parent_expr =
1710  window_func_scalar_exprs[window_func_rex_idx].get();
1711 
1712  // Replace window func rex with an input rex
1713  auto window_func_result_input = std::make_unique<const RexInput>(
1714  window_func_project_node.get(), window_func_rex_idx);
1715  RexWindowFuncReplacementVisitor replacer(std::move(window_func_result_input));
1716  auto new_parent_rex = replacer.visit(window_func_parent_expr);
1717 
1718  // Put the parent expr in the new scalar exprs
1719  new_scalar_exprs.emplace_back(std::move(new_parent_rex));
1720 
1721  // Put the window func expr in cur scalar exprs
1722  window_func_scalar_exprs[window_func_rex_idx] = std::move(window_func_rex_copy);
1723  }
1724  }
1725 
1726  CHECK_EQ(window_func_scalar_exprs.size(), new_scalar_exprs.size());
1727  window_func_project_node->setExpressions(window_func_scalar_exprs);
1728 
1729  // Ensure any inputs from the node containing the expression (the "new" node)
1730  // exist on the window function project node, e.g. if we had a binary operation
1731  // involving an aggregate value or column not included in the top level
1732  // projection list.
1733  RexInputBackpropagationVisitor input_visitor(window_func_project_node.get());
1734  for (size_t i = 0; i < new_scalar_exprs.size(); i++) {
1735  if (dynamic_cast<const RexInput*>(new_scalar_exprs[i].get())) {
1736  // ignore top level inputs, these were copied directly from the previous
1737  // node
1738  continue;
1739  }
1740  new_scalar_exprs[i] = input_visitor.visit(new_scalar_exprs[i].get());
1741  }
1742 
1743  // Build the new project node and insert it into the list after the project node
1744  // containing the window function
1745  auto new_project =
1746  std::make_shared<RelProject>(new_scalar_exprs,
1747  window_func_project_node->getFields(),
1748  window_func_project_node);
1749  node_list.insert(std::next(node_itr), new_project);
1750 
1751  // Rebind all the following inputs
1752  for (auto rebind_itr = std::next(node_itr, 2); rebind_itr != node_list.end();
1753  rebind_itr++) {
1754  (*rebind_itr)->replaceInput(window_func_project_node, new_project);
1755  }
1756  }
1757  }
1758  nodes.assign(node_list.begin(), node_list.end());
1759 }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
virtual T visit(const RexScalar *rex_scalar) const
Definition: RexVisitor.h:27
CHECK(cgen_state)
const RexScalar * getProjectAt(const size_t idx) const
#define CHECK_LT(x, y)
Definition: Logger.h:200

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<std::string> anonymous_namespace{RelAlgAbstractInterpreter.cpp}::strings_from_json_array ( const rapidjson::Value &  json_str_arr)
noexcept

Definition at line 779 of file RelAlgAbstractInterpreter.cpp.

References CHECK().

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchAggregate(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchProject(), anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::getFieldNamesFromScanNode(), and anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::getRelAlgInputs().

780  {
781  CHECK(json_str_arr.IsArray());
782  std::vector<std::string> fields;
783  for (auto json_str_arr_it = json_str_arr.Begin(); json_str_arr_it != json_str_arr.End();
784  ++json_str_arr_it) {
785  CHECK(json_str_arr_it->IsString());
786  fields.emplace_back(json_str_arr_it->GetString());
787  }
788  return fields;
789 }
CHECK(cgen_state)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

JoinType anonymous_namespace{RelAlgAbstractInterpreter.cpp}::to_join_type ( const std::string &  join_type_name)

Definition at line 846 of file RelAlgAbstractInterpreter.cpp.

References INNER, and LEFT.

Referenced by anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RelAlgAbstractInterpreter::dispatchJoin().

846  {
847  if (join_type_name == "inner") {
848  return JoinType::INNER;
849  }
850  if (join_type_name == "left") {
851  return JoinType::LEFT;
852  }
853  throw QueryNotSupported("Join type (" + join_type_name + ") not supported");
854 }

+ Here is the caller graph for this function:

Variable Documentation

const unsigned anonymous_namespace{RelAlgAbstractInterpreter.cpp}::FIRST_RA_NODE_ID = 1

Definition at line 35 of file RelAlgAbstractInterpreter.cpp.

Referenced by RelAlgNode::resetRelAlgFirstId().