OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{IRCodegen.cpp} Namespace Reference

Classes

class  ExprTableIdVisitor
 

Functions

void add_qualifier_to_execution_unit (RelAlgExecutionUnit &ra_exe_unit, const std::shared_ptr< Analyzer::Expr > &qual)
 
void check_if_loop_join_is_allowed (RelAlgExecutionUnit &ra_exe_unit, const ExecutionOptions &eo, const std::vector< InputTableInfo > &query_infos, const size_t level_idx, const std::string &fail_reason)
 
void check_valid_join_qual (std::shared_ptr< Analyzer::BinOper > &bin_oper)
 

Function Documentation

void anonymous_namespace{IRCodegen.cpp}::add_qualifier_to_execution_unit ( RelAlgExecutionUnit ra_exe_unit,
const std::shared_ptr< Analyzer::Expr > &  qual 
)

Definition at line 496 of file IRCodegen.cpp.

References qual_to_conjunctive_form(), RelAlgExecutionUnit::quals, and RelAlgExecutionUnit::simple_quals.

Referenced by Executor::buildCurrentLevelHashTable().

497  {
498  const auto qual_cf = qual_to_conjunctive_form(qual);
499  ra_exe_unit.simple_quals.insert(ra_exe_unit.simple_quals.end(),
500  qual_cf.simple_quals.begin(),
501  qual_cf.simple_quals.end());
502  ra_exe_unit.quals.insert(
503  ra_exe_unit.quals.end(), qual_cf.quals.begin(), qual_cf.quals.end());
504 }
QualsConjunctiveForm qual_to_conjunctive_form(const std::shared_ptr< Analyzer::Expr > qual_expr)
std::list< std::shared_ptr< Analyzer::Expr > > quals
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:

void anonymous_namespace{IRCodegen.cpp}::check_if_loop_join_is_allowed ( RelAlgExecutionUnit ra_exe_unit,
const ExecutionOptions eo,
const std::vector< InputTableInfo > &  query_infos,
const size_t  level_idx,
const std::string &  fail_reason 
)

Definition at line 506 of file IRCodegen.cpp.

References ExecutionOptions::allow_loop_joins, is_trivial_loop_join(), and RelAlgExecutionUnit::join_quals.

510  {
511  if (eo.allow_loop_joins) {
512  return;
513  }
514  if (level_idx + 1 != ra_exe_unit.join_quals.size()) {
515  throw std::runtime_error(
516  "Hash join failed, reason(s): " + fail_reason +
517  " | Cannot fall back to loop join for intermediate join quals");
518  }
519  if (!is_trivial_loop_join(query_infos, ra_exe_unit)) {
520  throw std::runtime_error(
521  "Hash join failed, reason(s): " + fail_reason +
522  " | Cannot fall back to loop join for non-trivial inner table size");
523  }
524 }
bool is_trivial_loop_join(const std::vector< InputTableInfo > &query_infos, const RelAlgExecutionUnit &ra_exe_unit)
Definition: Execute.cpp:1182
const JoinQualsPerNestingLevel join_quals

+ Here is the call graph for this function:

void anonymous_namespace{IRCodegen.cpp}::check_valid_join_qual ( std::shared_ptr< Analyzer::BinOper > &  bin_oper)

Definition at line 526 of file IRCodegen.cpp.

References SQLTypeInfo::get_type(), Analyzer::Expr::get_type_info(), and kARRAY.

Referenced by Executor::buildCurrentLevelHashTable().

526  {
527  // check whether a join qual is valid before entering the hashtable build and codegen
528 
529  auto lhs_cv = dynamic_cast<const Analyzer::ColumnVar*>(bin_oper->get_left_operand());
530  auto rhs_cv = dynamic_cast<const Analyzer::ColumnVar*>(bin_oper->get_right_operand());
531  if (lhs_cv && rhs_cv && !bin_oper->is_overlaps_oper()) {
532  auto lhs_type = lhs_cv->get_type_info().get_type();
533  auto rhs_type = rhs_cv->get_type_info().get_type();
534  // check #1. avoid a join btw full array columns
535  if (lhs_type == SQLTypes::kARRAY && rhs_type == SQLTypes::kARRAY) {
536  throw std::runtime_error(
537  "Join operation between full array columns (i.e., R.arr = S.arr) instead of "
538  "indexed array columns (i.e., R.arr[1] = S.arr[2]) is not supported yet.");
539  }
540  }
541 }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:77

+ Here is the call graph for this function:

+ Here is the caller graph for this function: