OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QueryRunner::anonymous_namespace{QueryRunner.cpp} Namespace Reference

Functions

std::shared_ptr< ExecutionResultrun_select_query_with_filter_push_down (QueryStateProxy query_state_proxy, const ExecutorDeviceType device_type, const bool hoist_literals, const bool allow_loop_joins, const bool just_explain, const ExecutorExplainType explain_type, const bool with_filter_push_down)
 

Function Documentation

std::shared_ptr<ExecutionResult> QueryRunner::anonymous_namespace{QueryRunner.cpp}::run_select_query_with_filter_push_down ( QueryStateProxy  query_state_proxy,
const ExecutorDeviceType  device_type,
const bool  hoist_literals,
const bool  allow_loop_joins,
const bool  just_explain,
const ExecutorExplainType  explain_type,
const bool  with_filter_push_down 
)

Definition at line 819 of file QueryRunner.cpp.

References ExecutionOptions::allow_loop_joins, cat(), CompilationOptions::defaults(), ExecutionOptions::defaults(), CompilationOptions::explain_type, ExecutionOptions::find_push_down_candidates, g_enable_columnar_output, g_enable_watchdog, g_gpu_mem_limit_percent, query_state::QueryState::getConstSessionInfo(), Executor::getExecutor(), query_state::QueryState::getQueryStr(), ExecutionOptions::gpu_input_mem_limit_percent, ExecutionOptions::just_explain, ExecutionOptions::output_columnar_hint, pg_shim(), run_benchmark_import::result, and Executor::UNITARY_EXECUTOR_ID.

Referenced by QueryRunner::QueryRunner::runSelectQuery().

826  {
827  auto& cat = query_state_proxy->getConstSessionInfo()->getCatalog();
830  co.explain_type = explain_type;
831 
834  eo.just_explain = just_explain;
835  eo.allow_loop_joins = allow_loop_joins;
836  eo.find_push_down_candidates = with_filter_push_down;
838 
839  auto calcite_mgr = cat.getCalciteMgr();
840  const auto calciteQueryParsingOption =
841  calcite_mgr->getCalciteQueryParsingOption(true, false, true, false);
842  auto calciteOptimizationOption =
843  calcite_mgr->getCalciteOptimizationOption(false, g_enable_watchdog, {}, false);
844  const auto query_ra = calcite_mgr
845  ->process(query_state_proxy,
846  pg_shim(query_state_proxy->getQueryStr()),
847  calciteQueryParsingOption,
848  calciteOptimizationOption)
849  .plan_result;
850  auto ra_executor = RelAlgExecutor(executor.get(), query_ra);
851  auto result = std::make_shared<ExecutionResult>(
852  ra_executor.executeRelAlgQuery(co, eo, false, false, nullptr));
853  const auto& filter_push_down_requests = result->getPushedDownFilterInfo();
854  if (!filter_push_down_requests.empty()) {
855  std::vector<TFilterPushDownInfo> filter_push_down_info;
856  for (const auto& req : filter_push_down_requests) {
857  TFilterPushDownInfo filter_push_down_info_for_request;
858  filter_push_down_info_for_request.input_prev = req.input_prev;
859  filter_push_down_info_for_request.input_start = req.input_start;
860  filter_push_down_info_for_request.input_next = req.input_next;
861  filter_push_down_info.push_back(filter_push_down_info_for_request);
862  }
863  calciteOptimizationOption.filter_push_down_info = filter_push_down_info;
864  const auto new_query_ra = calcite_mgr
865  ->process(query_state_proxy,
866  pg_shim(query_state_proxy->getQueryStr()),
867  calciteQueryParsingOption,
868  calciteOptimizationOption)
869  .plan_result;
870  auto eo_modified = eo;
871  eo_modified.find_push_down_candidates = false;
872  eo_modified.just_calcite_explain = false;
873  auto new_ra_executor = RelAlgExecutor(executor.get(), new_query_ra);
874  return std::make_shared<ExecutionResult>(
875  new_ra_executor.executeRelAlgQuery(co, eo_modified, false, false, nullptr));
876  } else {
877  return result;
878  }
879 }
std::string cat(Ts &&...args)
std::string const & getQueryStr() const
Definition: QueryState.h:159
static std::shared_ptr< Executor > getExecutor(const ExecutorId id, const std::string &debug_dir="", const std::string &debug_file="", const SystemParameters &system_parameters=SystemParameters())
Definition: Execute.cpp:513
bool g_enable_columnar_output
Definition: Execute.cpp:106
ExecutorExplainType explain_type
bool g_enable_watchdog
double g_gpu_mem_limit_percent
Definition: QueryRunner.cpp:56
static CompilationOptions defaults(const ExecutorDeviceType device_type=ExecutorDeviceType::GPU)
std::string pg_shim(std::string const &query)
double gpu_input_mem_limit_percent
static constexpr ExecutorId UNITARY_EXECUTOR_ID
Definition: Execute.h:423
static ExecutionOptions defaults()
std::shared_ptr< Catalog_Namespace::SessionInfo const > getConstSessionInfo() const
Definition: QueryState.cpp:84

+ Here is the call graph for this function:

+ Here is the caller graph for this function: