OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RelAlgTranslator.h File Reference
#include "Execute.h"
#include "RelAlgDag.h"
#include "ThirdParty/robin_hood/robin_hood.h"
#include <ctime>
#include <memory>
#include <unordered_map>
#include <vector>
+ Include dependency graph for RelAlgTranslator.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RelAlgTranslator
 
struct  QualsConjunctiveForm
 

Namespaces

 Analyzer
 
 Catalog_Namespace
 
 query_state
 

Functions

QualsConjunctiveForm qual_to_conjunctive_form (const std::shared_ptr< Analyzer::Expr > qual_expr)
 
std::vector< std::shared_ptr
< Analyzer::Expr > > 
qual_to_disjunctive_form (const std::shared_ptr< Analyzer::Expr > &qual_expr)
 

Variables

auto func_resolve
 

Function Documentation

QualsConjunctiveForm qual_to_conjunctive_form ( const std::shared_ptr< Analyzer::Expr qual_expr)

Definition at line 2526 of file RelAlgTranslator.cpp.

References CHECK, kAND, qual_to_conjunctive_form(), rewrite_expr(), and QualsConjunctiveForm::simple_quals.

Referenced by anonymous_namespace{IRCodegen.cpp}::add_qualifier_to_execution_unit(), RelAlgExecutor::makeJoinQuals(), qual_to_conjunctive_form(), anonymous_namespace{RelAlgExecutor.cpp}::reverse_logical_distribution(), Executor::skipFragmentInnerJoins(), and anonymous_namespace{RelAlgExecutor.cpp}::translate_quals().

2527  {
2528  CHECK(qual_expr);
2529  auto bin_oper = std::dynamic_pointer_cast<const Analyzer::BinOper>(qual_expr);
2530  if (!bin_oper) {
2531  const auto rewritten_qual_expr = rewrite_expr(qual_expr.get());
2532  return {{}, {rewritten_qual_expr ? rewritten_qual_expr : qual_expr}};
2533  }
2534 
2535  if (bin_oper->get_optype() == kAND) {
2536  const auto lhs_cf = qual_to_conjunctive_form(bin_oper->get_own_left_operand());
2537  const auto rhs_cf = qual_to_conjunctive_form(bin_oper->get_own_right_operand());
2538  auto simple_quals = lhs_cf.simple_quals;
2539  simple_quals.insert(
2540  simple_quals.end(), rhs_cf.simple_quals.begin(), rhs_cf.simple_quals.end());
2541  auto quals = lhs_cf.quals;
2542  quals.insert(quals.end(), rhs_cf.quals.begin(), rhs_cf.quals.end());
2543  return {simple_quals, quals};
2544  }
2545  int rte_idx{0};
2546  const auto simple_qual = bin_oper->normalize_simple_predicate(rte_idx);
2547  return simple_qual ? QualsConjunctiveForm{{simple_qual}, {}}
2548  : QualsConjunctiveForm{{}, {qual_expr}};
2549 }
Analyzer::ExpressionPtr rewrite_expr(const Analyzer::Expr *expr)
QualsConjunctiveForm qual_to_conjunctive_form(const std::shared_ptr< Analyzer::Expr > qual_expr)
Definition: sqldefs.h:36
#define CHECK(condition)
Definition: Logger.h:222
const 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:

std::vector<std::shared_ptr<Analyzer::Expr> > qual_to_disjunctive_form ( const std::shared_ptr< Analyzer::Expr > &  qual_expr)

Definition at line 2551 of file RelAlgTranslator.cpp.

References CHECK, kOR, qual_to_disjunctive_form(), and rewrite_expr().

Referenced by qual_to_disjunctive_form(), and anonymous_namespace{RelAlgExecutor.cpp}::reverse_logical_distribution().

2552  {
2553  CHECK(qual_expr);
2554  const auto bin_oper = std::dynamic_pointer_cast<const Analyzer::BinOper>(qual_expr);
2555  if (!bin_oper) {
2556  const auto rewritten_qual_expr = rewrite_expr(qual_expr.get());
2557  return {rewritten_qual_expr ? rewritten_qual_expr : qual_expr};
2558  }
2559  if (bin_oper->get_optype() == kOR) {
2560  const auto lhs_df = qual_to_disjunctive_form(bin_oper->get_own_left_operand());
2561  const auto rhs_df = qual_to_disjunctive_form(bin_oper->get_own_right_operand());
2562  auto quals = lhs_df;
2563  quals.insert(quals.end(), rhs_df.begin(), rhs_df.end());
2564  return quals;
2565  }
2566  return {qual_expr};
2567 }
Definition: sqldefs.h:37
Analyzer::ExpressionPtr rewrite_expr(const Analyzer::Expr *expr)
#define CHECK(condition)
Definition: Logger.h:222
std::vector< std::shared_ptr< Analyzer::Expr > > qual_to_disjunctive_form(const std::shared_ptr< Analyzer::Expr > &qual_expr)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation