OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CardinalityEstimator.cpp File Reference
#include "CardinalityEstimator.h"
#include "ErrorHandling.h"
#include "ExpressionRewrite.h"
#include "RelAlgExecutor.h"
+ Include dependency graph for CardinalityEstimator.cpp:

Go to the source code of this file.

Functions

RelAlgExecutionUnit create_ndv_execution_unit (const RelAlgExecutionUnit &ra_exe_unit)
 
RelAlgExecutionUnit create_count_all_execution_unit (const RelAlgExecutionUnit &ra_exe_unit, std::shared_ptr< Analyzer::Expr > replacement_target)
 
ResultSetPtr reduce_estimator_results (const RelAlgExecutionUnit &ra_exe_unit, std::vector< std::pair< ResultSetPtr, std::vector< size_t >>> &results_per_device)
 

Function Documentation

RelAlgExecutionUnit create_count_all_execution_unit ( const RelAlgExecutionUnit ra_exe_unit,
std::shared_ptr< Analyzer::Expr replacement_target 
)

Definition at line 90 of file CardinalityEstimator.cpp.

References Default, RelAlgExecutionUnit::input_col_descs, RelAlgExecutionUnit::input_descs, RelAlgExecutionUnit::join_quals, RelAlgExecutionUnit::quals, RelAlgExecutionUnit::query_state, RelAlgExecutionUnit::simple_quals, strip_join_covered_filter_quals(), and RelAlgExecutionUnit::union_all.

Referenced by RelAlgExecutor::getFilteredCountAll().

92  {
93  return {ra_exe_unit.input_descs,
94  ra_exe_unit.input_col_descs,
95  ra_exe_unit.simple_quals,
96  strip_join_covered_filter_quals(ra_exe_unit.quals, ra_exe_unit.join_quals),
97  ra_exe_unit.join_quals,
98  {},
99  {replacement_target.get()},
100  nullptr,
101  SortInfo{{}, SortAlgorithm::Default, 0, 0},
102  0,
103  false,
104  ra_exe_unit.union_all,
105  ra_exe_unit.query_state};
106 }
const std::optional< bool > union_all
std::vector< InputDescriptor > input_descs
std::list< std::shared_ptr< Analyzer::Expr > > strip_join_covered_filter_quals(const std::list< std::shared_ptr< Analyzer::Expr >> &quals, const JoinQualsPerNestingLevel &join_quals)
const JoinQualsPerNestingLevel join_quals
std::list< std::shared_ptr< Analyzer::Expr > > quals
std::shared_ptr< const query_state::QueryState > query_state
std::list< std::shared_ptr< const InputColDescriptor > > input_col_descs
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:

RelAlgExecutionUnit create_ndv_execution_unit ( const RelAlgExecutionUnit ra_exe_unit)

Definition at line 74 of file CardinalityEstimator.cpp.

References Default, RelAlgExecutionUnit::groupby_exprs, RelAlgExecutionUnit::input_col_descs, RelAlgExecutionUnit::input_descs, RelAlgExecutionUnit::join_quals, RelAlgExecutionUnit::quals, RelAlgExecutionUnit::query_state, RelAlgExecutionUnit::simple_quals, and RelAlgExecutionUnit::union_all.

Referenced by RelAlgExecutor::getNDVEstimation().

74  {
75  return {ra_exe_unit.input_descs,
76  ra_exe_unit.input_col_descs,
77  ra_exe_unit.simple_quals,
78  ra_exe_unit.quals,
79  ra_exe_unit.join_quals,
80  {},
81  {},
82  makeExpr<Analyzer::NDVEstimator>(ra_exe_unit.groupby_exprs),
84  0,
85  false,
86  ra_exe_unit.union_all,
87  ra_exe_unit.query_state};
88 }
const std::optional< bool > union_all
std::vector< InputDescriptor > input_descs
const std::list< std::shared_ptr< Analyzer::Expr > > groupby_exprs
const JoinQualsPerNestingLevel join_quals
std::list< std::shared_ptr< Analyzer::Expr > > quals
std::shared_ptr< const query_state::QueryState > query_state
std::list< std::shared_ptr< const InputColDescriptor > > input_col_descs
std::list< std::shared_ptr< Analyzer::Expr > > simple_quals

+ Here is the caller graph for this function:

ResultSetPtr reduce_estimator_results ( const RelAlgExecutionUnit ra_exe_unit,
std::vector< std::pair< ResultSetPtr, std::vector< size_t >>> &  results_per_device 
)

Definition at line 108 of file CardinalityEstimator.cpp.

References CHECK(), and RelAlgExecutionUnit::estimator.

Referenced by Executor::reduceMultiDeviceResults().

110  {
111  if (results_per_device.empty()) {
112  return nullptr;
113  }
114  CHECK(dynamic_cast<const Analyzer::NDVEstimator*>(ra_exe_unit.estimator.get()));
115  const auto& result_set = results_per_device.front().first;
116  CHECK(result_set);
117  auto estimator_buffer = result_set->getHostEstimatorBuffer();
118  CHECK(estimator_buffer);
119  for (size_t i = 1; i < results_per_device.size(); ++i) {
120  const auto& next_result_set = results_per_device[i].first;
121  const auto other_estimator_buffer = next_result_set->getHostEstimatorBuffer();
122  for (size_t off = 0; off < ra_exe_unit.estimator->getBufferSize(); ++off) {
123  estimator_buffer[off] |= other_estimator_buffer[off];
124  }
125  }
126  return std::move(result_set);
127 }
CHECK(cgen_state)
const std::shared_ptr< Analyzer::Estimator > estimator

+ Here is the call graph for this function:

+ Here is the caller graph for this function: