Class RelAlgExecutor

class RelAlgExecutor : private StorageIOFacility

Public Types

using TargetInfoList = std::vector<TargetInfo>

Public Functions

RelAlgExecutor(Executor *executor, const Catalog_Namespace::Catalog &cat, std::shared_ptr<const query_state::QueryState> query_state = nullptr)
RelAlgExecutor(Executor *executor, const Catalog_Namespace::Catalog &cat, const std::string &query_ra, std::shared_ptr<const query_state::QueryState> query_state = nullptr)
RelAlgExecutor(Executor *executor, const Catalog_Namespace::Catalog &cat, std::unique_ptr<RelAlgDagBuilder> query_dag, std::shared_ptr<const query_state::QueryState> query_state = nullptr)
size_t getOuterFragmentCount(const CompilationOptions &co, const ExecutionOptions &eo)
ExecutionResult executeRelAlgQuery(const CompilationOptions &co, const ExecutionOptions &eo, const bool just_explain_plan, RenderInfo *render_info)
ExecutionResult executeRelAlgQueryWithFilterPushDown(const RaExecutionSequence &seq, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
void prepareLeafExecution(const AggregatedColRange &agg_col_range, const StringDictionaryGenerations &string_dictionary_generations, const TableGenerations &table_generations)
ExecutionResult executeRelAlgSeq(const RaExecutionSequence &seq, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms, const bool with_existing_temp_tables = false)
ExecutionResult executeRelAlgSubSeq(const RaExecutionSequence &seq, const std::pair<size_t, size_t> interval, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
QueryStepExecutionResult executeRelAlgQuerySingleStep(const RaExecutionSequence &seq, const size_t step_idx, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info)
void addLeafResult(const unsigned id, const AggregatedResult &result)
const RelAlgNode &getRootRelAlgNode() const
void prepareForeignTables()
std::shared_ptr<const RelAlgNode> getRootRelAlgNodeShPtr() const
std::pair<std::vector<unsigned>, std::unordered_map<unsigned, JoinQualsPerNestingLevel>> getJoinInfo(const RelAlgNode *root_node)
std::shared_ptr<RelAlgTranslator> getRelAlgTranslator(const RelAlgNode *root_node)
const std::vector<std::shared_ptr<RexSubQuery>> &getSubqueries() const
std::optional<RegisteredQueryHint> getParsedQueryHint(const RelAlgNode *node)
std::optional<std::unordered_map<size_t, std::unordered_map<unsigned, RegisteredQueryHint>>> getParsedQueryHints()
std::optional<RegisteredQueryHint> getGlobalQueryHint()
ExecutionResult executeSimpleInsert(const Analyzer::Query &insert_query)
AggregatedColRange computeColRangesCache()
StringDictionaryGenerations computeStringDictionaryGenerations()
TableGenerations computeTableGenerations()
Executor *getExecutor() const
void cleanupPostExecution()
void executePostExecutionCallback()
RaExecutionSequence getRaExecutionSequence(const RelAlgNode *root_node, Executor *executor)
void prepareForeignTable()

Public Static Functions

std::string getErrorMessageFromCode(const int32_t error_code)

Private Functions

void initializeParallelismHints()
ExecutionResult executeRelAlgQueryNoRetry(const CompilationOptions &co, const ExecutionOptions &eo, const bool just_explain_plan, RenderInfo *render_info)
void executeRelAlgStep(const RaExecutionSequence &seq, const size_t step_idx, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
void executeUpdate(const RelAlgNode *node, const CompilationOptions &co, const ExecutionOptions &eo, const int64_t queue_time_ms)
void executeDelete(const RelAlgNode *node, const CompilationOptions &co, const ExecutionOptions &eo_in, const int64_t queue_time_ms)
ExecutionResult executeCompound(const RelCompound *compound, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
ExecutionResult executeAggregate(const RelAggregate *aggregate, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
ExecutionResult executeProject(const RelProject *project, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms, const std::optional<size_t> previous_count)
ExecutionResult executeTableFunction(const RelTableFunction *table_func, const CompilationOptions &co_in, const ExecutionOptions &eo, const int64_t queue_time_ms)
void computeWindow(const RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co, const ExecutionOptions &eo, ColumnCacheMap &column_cache_map, const int64_t queue_time_ms)
std::unique_ptr<WindowFunctionContext> createWindowFunctionContext(const Analyzer::WindowFunction *window_func, const std::shared_ptr<Analyzer::BinOper> &partition_key_cond, const RelAlgExecutionUnit &ra_exe_unit, const std::vector<InputTableInfo> &query_infos, const CompilationOptions &co, ColumnCacheMap &column_cache_map, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner)
ExecutionResult executeFilter(const RelFilter *filter, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
ExecutionResult executeSort(const RelSort *sort, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
ExecutionResult executeLogicalValues(const RelLogicalValues *logical_values, const ExecutionOptions &eo)
ExecutionResult executeModify(const RelModify *modify, const ExecutionOptions &eo)
ExecutionResult executeUnion(const RelLogicalUnion *logical_union, const RaExecutionSequence &seq, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const int64_t queue_time_ms)
RelAlgExecutor::WorkUnit createSortInputWorkUnit(const RelSort *sort, std::list<Analyzer::OrderEntry> &order_entries, const ExecutionOptions &eo)
ExecutionResult executeWorkUnit(const WorkUnit &work_unit, const std::vector<TargetMetaInfo> &targets_meta, const bool is_agg, const CompilationOptions &co_in, const ExecutionOptions &eo_in, RenderInfo *render_info, const int64_t queue_time_ms, const std::optional<size_t> previous_count = std::nullopt)
size_t getNDVEstimation(const WorkUnit &work_unit, const int64_t range, const bool is_agg, const CompilationOptions &co, const ExecutionOptions &eo)
std::optional<size_t> getFilteredCountAll(const WorkUnit &work_unit, const bool is_agg, const CompilationOptions &co, const ExecutionOptions &eo)
FilterSelectivity getFilterSelectivity(const std::vector<std::shared_ptr<Analyzer::Expr>> &filter_expressions, const CompilationOptions &co, const ExecutionOptions &eo)

Given a set of filter expressions for a table, it launches a new COUNT query to compute the number of passing rows, and then generates a set of statistics related to those filters. Later, these stats are used to decide whether a filter should be pushed down or not.

std::vector<PushedDownFilterInfo> selectFiltersToBePushedDown(const RelAlgExecutor::WorkUnit &work_unit, const CompilationOptions &co, const ExecutionOptions &eo)

Goes through all candidate filters and evaluate whether they pass the selectivity criteria or not.

bool isRowidLookup(const WorkUnit &work_unit)
ExecutionResult handleOutOfMemoryRetry(const RelAlgExecutor::WorkUnit &work_unit, const std::vector<TargetMetaInfo> &targets_meta, const bool is_agg, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, const bool was_multifrag_kernel_launch, const int64_t queue_time_ms)
RelAlgExecutor::WorkUnit createWorkUnit(const RelAlgNode *node, const SortInfo &sort_info, const ExecutionOptions &eo)
RelAlgExecutor::WorkUnit createCompoundWorkUnit(const RelCompound *compound, const SortInfo &sort_info, const ExecutionOptions &eo)
RelAlgExecutor::WorkUnit createAggregateWorkUnit(const RelAggregate *aggregate, const SortInfo &sort_info, const bool just_explain)
RelAlgExecutor::WorkUnit createProjectWorkUnit(const RelProject *project, const SortInfo &sort_info, const ExecutionOptions &eo)
RelAlgExecutor::WorkUnit createFilterWorkUnit(const RelFilter *filter, const SortInfo &sort_info, const bool just_explain)
WorkUnit createJoinWorkUnit(const RelJoin *, const SortInfo&, const bool just_explain)
RelAlgExecutor::WorkUnit createUnionWorkUnit(const RelLogicalUnion *logical_union, const SortInfo &sort_info, const ExecutionOptions &eo)
RelAlgExecutor::TableFunctionWorkUnit createTableFunctionWorkUnit(const RelTableFunction *table_func, const bool just_explain, const bool is_gpu)
void addTemporaryTable(const int table_id, const ResultSetPtr &result)
void eraseFromTemporaryTables(const int table_id)
void handleNop(RaExecutionDesc &ed)
std::unordered_map<unsigned, JoinQualsPerNestingLevel> &getLeftDeepJoinTreesInfo()
JoinQualsPerNestingLevel translateLeftDeepJoinFilter(const RelLeftDeepInnerJoin *join, const std::vector<InputDescriptor> &input_descs, const std::unordered_map<const RelAlgNode *, int> &input_to_nest_level, const bool just_explain)
std::list<std::shared_ptr<Analyzer::Expr>> makeJoinQuals(const RexScalar *join_condition, const std::vector<JoinType> &join_types, const std::unordered_map<const RelAlgNode *, int> &input_to_nest_level, const bool just_explain) const
void setHasStepForUnion(bool flag)
bool hasStepForUnion() const
bool canUseResultsetCache(const ExecutionOptions &eo, RenderInfo *render_info) const
void setupCaching(const RelAlgNode *ra)

Private Members

Executor *executor_
const Catalog_Namespace::Catalog &cat_
std::unique_ptr<RelAlgDagBuilder> query_dag_
std::shared_ptr<const query_state::QueryState> query_state_
TemporaryTables temporary_tables_
time_t now_
std::unordered_map<unsigned, JoinQualsPerNestingLevel> left_deep_join_info_
std::vector<std::shared_ptr<Analyzer::Expr>> target_exprs_owned_
std::unordered_map<unsigned, AggregatedResult> leaf_results_
int64_t queue_time_ms_
bool has_step_for_union_
std::unique_ptr<TransactionParameters> dml_transaction_parameters_
std::optional<std::function<void()>> post_execution_callback_

Private Static Functions

void handlePersistentError(const int32_t error_code)

Private Static Attributes

SpeculativeTopNBlacklist speculative_topn_blacklist_

Friends

friend RelAlgExecutor::PendingExecutionClosure
struct TableFunctionWorkUnit

Public Members

TableFunctionExecutionUnit exe_unit
const RelAlgNode *body
struct WorkUnit

Public Members

RelAlgExecutionUnit exe_unit
const RelAlgNode *body
const size_t max_groups_buffer_entry_guess
std::unique_ptr<QueryRewriter> query_rewriter
const std::vector<size_t> input_permutation
const std::vector<size_t> left_deep_join_input_sizes