OmniSciDB  b28c0d5765
 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 787 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().

794  {
795  auto& cat = query_state_proxy->getConstSessionInfo()->getCatalog();
798  co.explain_type = explain_type;
799 
802  eo.just_explain = just_explain;
803  eo.allow_loop_joins = allow_loop_joins;
804  eo.find_push_down_candidates = with_filter_push_down;
806 
807  auto calcite_mgr = cat.getCalciteMgr();
808  const auto calciteQueryParsingOption =
809  calcite_mgr->getCalciteQueryParsingOption(true, false, true);
810  auto calciteOptimizationOption =
811  calcite_mgr->getCalciteOptimizationOption(false, g_enable_watchdog, {}, false);
812  const auto query_ra = calcite_mgr
813  ->process(query_state_proxy,
814  pg_shim(query_state_proxy->getQueryStr()),
815  calciteQueryParsingOption,
816  calciteOptimizationOption)
817  .plan_result;
818  auto ra_executor = RelAlgExecutor(executor.get(), cat, query_ra);
819  auto result = std::make_shared<ExecutionResult>(
820  ra_executor.executeRelAlgQuery(co, eo, false, nullptr));
821  const auto& filter_push_down_requests = result->getPushedDownFilterInfo();
822  if (!filter_push_down_requests.empty()) {
823  std::vector<TFilterPushDownInfo> filter_push_down_info;
824  for (const auto& req : filter_push_down_requests) {
825  TFilterPushDownInfo filter_push_down_info_for_request;
826  filter_push_down_info_for_request.input_prev = req.input_prev;
827  filter_push_down_info_for_request.input_start = req.input_start;
828  filter_push_down_info_for_request.input_next = req.input_next;
829  filter_push_down_info.push_back(filter_push_down_info_for_request);
830  }
831  calciteOptimizationOption.filter_push_down_info = filter_push_down_info;
832  const auto new_query_ra = calcite_mgr
833  ->process(query_state_proxy,
834  pg_shim(query_state_proxy->getQueryStr()),
835  calciteQueryParsingOption,
836  calciteOptimizationOption)
837  .plan_result;
838  auto eo_modified = eo;
839  eo_modified.find_push_down_candidates = false;
840  eo_modified.just_calcite_explain = false;
841  auto new_ra_executor = RelAlgExecutor(executor.get(), cat, new_query_ra);
842  return std::make_shared<ExecutionResult>(
843  new_ra_executor.executeRelAlgQuery(co, eo_modified, false, nullptr));
844  } else {
845  return result;
846  }
847 }
std::string cat(Ts &&...args)
std::string const & getQueryStr() const
Definition: QueryState.h:157
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:478
bool g_enable_columnar_output
Definition: Execute.cpp:99
ExecutorExplainType explain_type
bool g_enable_watchdog
double g_gpu_mem_limit_percent
Definition: QueryRunner.cpp:53
static CompilationOptions defaults(const ExecutorDeviceType device_type=ExecutorDeviceType::GPU)
double gpu_input_mem_limit_percent
static ExecutionOptions defaults()
std::shared_ptr< Catalog_Namespace::SessionInfo const > getConstSessionInfo() const
Definition: QueryState.cpp:88
std::string pg_shim(const std::string &query)
static const ExecutorId UNITARY_EXECUTOR_ID
Definition: Execute.h:376

+ Here is the call graph for this function:

+ Here is the caller graph for this function: