OmniSciDB
a5dc49c757
|
#include "RelAlgOptimizer.h"
#include "Logger/Logger.h"
#include "RexVisitor.h"
#include "Visitors/RexSubQueryIdCollector.h"
#include <numeric>
#include <string>
#include <unordered_map>
Go to the source code of this file.
Namespaces | |
anonymous_namespace{RelAlgOptimizer.cpp} | |
Functions | |
size_t | anonymous_namespace{RelAlgOptimizer.cpp}::get_actual_source_size (const RelProject *curr_project, const std::unordered_set< const RelProject * > &projects_to_remove) |
bool | anonymous_namespace{RelAlgOptimizer.cpp}::safe_to_redirect (const RelProject *project, const std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web) |
bool | anonymous_namespace{RelAlgOptimizer.cpp}::is_identical_copy (const RelProject *project, const std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web, const std::unordered_set< const RelProject * > &projects_to_remove, std::unordered_set< const RelProject * > &permutating_projects) |
void | anonymous_namespace{RelAlgOptimizer.cpp}::propagate_rex_input_renumber (const RelFilter *excluded_root, const std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web) |
void | anonymous_namespace{RelAlgOptimizer.cpp}::redirect_inputs_of (std::shared_ptr< RelAlgNode > node, const std::unordered_set< const RelProject * > &projects, const std::unordered_set< const RelProject * > &permutating_projects, const std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web) |
void | anonymous_namespace{RelAlgOptimizer.cpp}::cleanup_dead_nodes (std::vector< std::shared_ptr< RelAlgNode >> &nodes) |
std::unordered_set< const RelProject * > | anonymous_namespace{RelAlgOptimizer.cpp}::get_visible_projects (const RelAlgNode *root) |
bool | anonymous_namespace{RelAlgOptimizer.cpp}::is_distinct (const size_t input_idx, const RelAlgNode *node) |
std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * > > | build_du_web (const std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept |
bool | project_separates_sort (const RelProject *project, const RelAlgNode *next_node) |
void | eliminate_identical_copy (std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept |
size_t | anonymous_namespace{RelAlgOptimizer.cpp}::pick_always_live_col_idx (const RelAlgNode *node) |
std::vector < std::unordered_set< size_t > > | anonymous_namespace{RelAlgOptimizer.cpp}::get_live_ins (const RelAlgNode *node, const std::unordered_map< const RelAlgNode *, std::unordered_set< size_t >> &live_outs) |
bool | anonymous_namespace{RelAlgOptimizer.cpp}::any_dead_col_in (const RelAlgNode *node, const std::unordered_set< size_t > &live_outs) |
bool | anonymous_namespace{RelAlgOptimizer.cpp}::does_redef_cols (const RelAlgNode *node) |
void | anonymous_namespace{RelAlgOptimizer.cpp}::add_new_indices_for (const RelAlgNode *node, std::unordered_map< const RelAlgNode *, std::unordered_map< size_t, size_t >> &new_liveouts, const std::unordered_set< size_t > &old_liveouts, const std::unordered_set< const RelAlgNode * > &intact_nodes, const std::unordered_map< const RelAlgNode *, size_t > &orig_node_sizes) |
std::vector< std::unique_ptr < const RexAgg > > | anonymous_namespace{RelAlgOptimizer.cpp}::renumber_rex_aggs (std::vector< std::unique_ptr< const RexAgg >> &agg_exprs, const std::unordered_map< size_t, size_t > &new_numbering) |
SortField | anonymous_namespace{RelAlgOptimizer.cpp}::renumber_sort_field (const SortField &old_field, const std::unordered_map< size_t, size_t > &new_numbering) |
std::unordered_map< const RelAlgNode *, std::unordered_set< size_t > > | anonymous_namespace{RelAlgOptimizer.cpp}::mark_live_columns (std::vector< std::shared_ptr< RelAlgNode >> &nodes) |
std::string | anonymous_namespace{RelAlgOptimizer.cpp}::get_field_name (const RelAlgNode *node, size_t index) |
void | anonymous_namespace{RelAlgOptimizer.cpp}::try_insert_coalesceable_proj (std::vector< std::shared_ptr< RelAlgNode >> &nodes, std::unordered_map< const RelAlgNode *, std::unordered_set< size_t >> &liveouts, std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web) |
std::pair< std::unordered_map < const RelAlgNode *, std::unordered_map< size_t, size_t > >, std::vector< const RelAlgNode * > > | anonymous_namespace{RelAlgOptimizer.cpp}::sweep_dead_columns (const std::unordered_map< const RelAlgNode *, std::unordered_set< size_t >> &live_outs, const std::vector< std::shared_ptr< RelAlgNode >> &nodes, const std::unordered_set< const RelAlgNode * > &intact_nodes, const std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web, const std::unordered_map< const RelAlgNode *, size_t > &orig_node_sizes) |
void | anonymous_namespace{RelAlgOptimizer.cpp}::propagate_input_renumbering (std::unordered_map< const RelAlgNode *, std::unordered_map< size_t, size_t >> &liveout_renumbering, const std::vector< const RelAlgNode * > &ready_nodes, const std::unordered_map< const RelAlgNode *, std::unordered_set< size_t >> &old_liveouts, const std::unordered_set< const RelAlgNode * > &intact_nodes, const std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web, const std::unordered_map< const RelAlgNode *, size_t > &orig_node_sizes) |
void | eliminate_dead_columns (std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept |
void | eliminate_dead_subqueries (std::vector< std::shared_ptr< RexSubQuery >> &subqueries, RelAlgNode const *root) |
void | sink_projected_boolean_expr_to_join (std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept |
void | anonymous_namespace{RelAlgOptimizer.cpp}::replace_all_usages (std::shared_ptr< const RelAlgNode > old_def_node, std::shared_ptr< const RelAlgNode > new_def_node, std::unordered_map< const RelAlgNode *, std::shared_ptr< RelAlgNode >> &deconst_mapping, std::unordered_map< const RelAlgNode *, std::unordered_set< const RelAlgNode * >> &du_web) |
void | fold_filters (std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept |
std::vector< const RexScalar * > | find_hoistable_conditions (const RexScalar *condition, const RelAlgNode *source, const size_t first_col_idx, const size_t last_col_idx) |
void | hoist_filter_cond_to_cross_join (std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept |
void | sync_field_names_if_necessary (std::shared_ptr< const RelProject > from_node, RelAlgNode *to_node) noexcept |
void | simplify_sort (std::vector< std::shared_ptr< RelAlgNode >> &nodes) noexcept |
|
noexcept |
Definition at line 416 of file RelAlgOptimizer.cpp.
References CHECK.
Referenced by eliminate_dead_columns(), eliminate_identical_copy(), fold_filters(), hoist_filter_cond_to_cross_join(), and sink_projected_boolean_expr_to_join().
|
noexcept |
Definition at line 1187 of file RelAlgOptimizer.cpp.
References anonymous_namespace{RelAlgOptimizer.cpp}::any_dead_col_in(), build_du_web(), CHECK, RelRexToStringConfig::defaults(), anonymous_namespace{RelAlgOptimizer.cpp}::does_redef_cols(), LOG, anonymous_namespace{RelAlgOptimizer.cpp}::mark_live_columns(), anonymous_namespace{RelAlgOptimizer.cpp}::propagate_input_renumbering(), setup::root, anonymous_namespace{RelAlgOptimizer.cpp}::sweep_dead_columns(), anonymous_namespace{RelAlgOptimizer.cpp}::try_insert_coalesceable_proj(), and logger::WARNING.
Referenced by RelAlgDagBuilder::optimizeDag().
void eliminate_dead_subqueries | ( | std::vector< std::shared_ptr< RexSubQuery >> & | subqueries, |
RelAlgNode const * | root | ||
) |
Definition at line 1253 of file RelAlgOptimizer.cpp.
References anonymous_namespace{Utm.h}::a, RexSubQueryIdCollector::getLiveRexSubQueryIds(), gpu_enabled::upper_bound(), and VLOG.
Referenced by RelAlgDagBuilder::optimizeDag().
|
noexcept |
Definition at line 494 of file RelAlgOptimizer.cpp.
References build_du_web(), CHECK, CHECK_EQ, anonymous_namespace{RelAlgOptimizer.cpp}::cleanup_dead_nodes(), anonymous_namespace{RelAlgOptimizer.cpp}::get_visible_projects(), anonymous_namespace{RelAlgOptimizer.cpp}::is_distinct(), anonymous_namespace{RelAlgOptimizer.cpp}::is_identical_copy(), project_separates_sort(), anonymous_namespace{RelAlgOptimizer.cpp}::redirect_inputs_of(), and gpu_enabled::swap().
Referenced by RelAlgDagBuilder::optimizeDag().
std::vector<const RexScalar*> find_hoistable_conditions | ( | const RexScalar * | condition, |
const RelAlgNode * | source, | ||
const size_t | first_col_idx, | ||
const size_t | last_col_idx | ||
) |
Definition at line 1536 of file RelAlgOptimizer.cpp.
References RexAbstractInput::getIndex(), kAND, and kEQ.
Referenced by hoist_filter_cond_to_cross_join().
|
noexcept |
Definition at line 1468 of file RelAlgOptimizer.cpp.
References build_du_web(), CHECK, CHECK_EQ, anonymous_namespace{RelAlgOptimizer.cpp}::cleanup_dead_nodes(), logger::DEBUG2, RelRexToStringConfig::defaults(), logger::fast_logging_check(), g_max_log_length, kAND, kBOOLEAN, anonymous_namespace{RelAlgOptimizer.cpp}::replace_all_usages(), substring(), and VLOG.
Referenced by RelAlgDagBuilder::optimizeDag().
|
noexcept |
Definition at line 1634 of file RelAlgOptimizer.cpp.
References build_du_web(), CHECK, find_hoistable_conditions(), RelFilter::getCondition(), RelAlgNode::getInput(), INNER, join(), kAND, kBOOLEAN, RelFilter::setCondition(), and RexVisitorBase< T >::visit().
Referenced by RelAlgDagBuilder::optimizeDag().
bool project_separates_sort | ( | const RelProject * | project, |
const RelAlgNode * | next_node | ||
) |
Return true if the input project separates two sort nodes, i.e. Sort -> Project -> Sort. This pattern often occurs in machine generated SQL, e.g. SELECT * FROM (SELECT * FROM t LIMIT 10) t0 LIMIT 1; Use this function to prevent optimizing out the intermediate project, as the project is required to ensure the first sort runs to completion prior to the second sort. Back to back sort nodes are not executable and will throw an error.
Definition at line 471 of file RelAlgOptimizer.cpp.
References CHECK, RelAlgNode::getInput(), RelAlgNode::inputCount(), and gpu_enabled::sort().
Referenced by eliminate_identical_copy().
|
noexcept |
Definition at line 1759 of file RelAlgOptimizer.cpp.
References sync_field_names_if_necessary().
Referenced by RelAlgDagBuilder::optimizeDag().
|
noexcept |
Definition at line 1320 of file RelAlgOptimizer.cpp.
References build_du_web(), CHECK, CHECK_EQ, join(), kBOOLEAN, and anonymous_namespace{RelAlgOptimizer.cpp}::mark_live_columns().
Referenced by RelAlgDagBuilder::optimizeDag().
|
noexcept |
Definition at line 1736 of file RelAlgOptimizer.cpp.
Referenced by simplify_sort().