OmniSciDB
a5dc49c757
|
#include "QueryEngine/ExpressionRewrite.h"
#include <algorithm>
#include <boost/locale/conversion.hpp>
#include <unordered_set>
#include "Logger/Logger.h"
#include "Parser/ParserNode.h"
#include "QueryEngine/DeepCopyVisitor.h"
#include "QueryEngine/Execute.h"
#include "QueryEngine/ScalarExprVisitor.h"
#include "QueryEngine/WindowExpressionRewrite.h"
#include "Shared/sqldefs.h"
#include "StringOps/StringOps.h"
Go to the source code of this file.
Namespaces | |
anonymous_namespace{ExpressionRewrite.cpp} | |
Functions | |
const Analyzer::Expr * | anonymous_namespace{ExpressionRewrite.cpp}::strip_likelihood (const Analyzer::Expr *expr) |
Analyzer::ExpressionPtr | rewrite_array_elements (Analyzer::Expr const *expr) |
Analyzer::ExpressionPtr | rewrite_expr (const Analyzer::Expr *expr) |
void | anonymous_namespace{ExpressionRewrite.cpp}::update_input_to_nest_lv (std::unordered_map< const RelAlgNode *, int > &input_to_nest_level, shared::ColumnKey const &column_key, int target_nest_lv) |
int | anonymous_namespace{ExpressionRewrite.cpp}::update_input_desc (std::vector< InputDescriptor > &input_descs, shared::ColumnKey const &column_key, int target_nest_lv) |
auto | anonymous_namespace{ExpressionRewrite.cpp}::update_input_col_desc (std::list< std::shared_ptr< const InputColDescriptor >> &input_col_desc, shared::ColumnKey const &column_key, int target_nest_lv) |
BoundingBoxIntersectJoinTranslationResult | translate_bounding_box_intersect_with_reordering (const std::shared_ptr< Analyzer::Expr > expr, std::vector< InputDescriptor > &input_descs, std::unordered_map< const RelAlgNode *, int > &input_to_nest_level, std::vector< size_t > &input_permutation, std::list< std::shared_ptr< const InputColDescriptor >> &input_col_desc, const BoundingBoxIntersectJoinRewriteType rewrite_type, Executor const *executor) |
BoundingBoxIntersectJoinTranslationInfo | convert_bbox_intersect_join (JoinQualsPerNestingLevel const &join_quals, std::vector< InputDescriptor > &input_descs, std::unordered_map< const RelAlgNode *, int > &input_to_nest_level, std::vector< size_t > &input_permutation, std::list< std::shared_ptr< const InputColDescriptor >> &input_col_desc, Executor const *executor) |
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) |
std::shared_ptr< Analyzer::Expr > | fold_expr (const Analyzer::Expr *expr) |
bool | self_join_not_covered_by_left_deep_tree (const Analyzer::ColumnVar *key_side, const Analyzer::ColumnVar *val_side, const int max_rte_covered) |
const int | get_max_rte_scan_table (std::unordered_map< int, llvm::Value * > &scan_idx_to_hash_pos) |
size_t | get_table_cardinality (shared::TableKey const &table_key, Executor const *executor) |
BoundingBoxIntersectJoinTranslationInfo convert_bbox_intersect_join | ( | JoinQualsPerNestingLevel const & | join_quals, |
std::vector< InputDescriptor > & | input_descs, | ||
std::unordered_map< const RelAlgNode *, int > & | input_to_nest_level, | ||
std::vector< size_t > & | input_permutation, | ||
std::list< std::shared_ptr< const InputColDescriptor >> & | input_col_desc, | ||
Executor const * | executor | ||
) |
Definition at line 1217 of file ExpressionRewrite.cpp.
References BBOX_INTERSECT_JOIN, BoundingBoxIntersectJoinTranslationResult::converted_bbox_intersect_join_info, g_enable_bbox_intersect_hashjoin, g_enable_distance_rangejoin, Analyzer::FunctionOper::getName(), BoundingBoxIntersectJoinSupportedFunction::is_bbox_intersect_supported_func(), kLE, kLT, RANGE_JOIN, BoundingBoxIntersectJoinTranslationResult::swap_arguments, translate_bounding_box_intersect_with_reordering(), JoinCondition::type, and UNKNOWN.
Referenced by RelAlgExecutor::createCompoundWorkUnit(), and RelAlgExecutor::createProjectWorkUnit().
std::shared_ptr<Analyzer::Expr> fold_expr | ( | const Analyzer::Expr * | expr | ) |
Definition at line 1356 of file ExpressionRewrite.cpp.
References kBIGINT, and anonymous_namespace{ExpressionRewrite.cpp}::strip_likelihood().
Referenced by RelAlgExecutor::createFilterWorkUnit(), RelAlgExecutor::makeJoinQuals(), anonymous_namespace{RelAlgExecutor.cpp}::set_transient_dict_maybe(), anonymous_namespace{RelAlgExecutor.cpp}::translate_quals(), anonymous_namespace{RelAlgExecutor.cpp}::translate_scalar_sources(), anonymous_namespace{RelAlgExecutor.cpp}::translate_targets(), RelAlgTranslator::translateBinaryGeoFunction(), RelAlgTranslator::translateDatePlusMinus(), RelAlgTranslator::translateGeoComparison(), and RelAlgTranslator::translateGeoFunctionArg().
const int get_max_rte_scan_table | ( | std::unordered_map< int, llvm::Value * > & | scan_idx_to_hash_pos | ) |
Definition at line 1401 of file ExpressionRewrite.cpp.
Referenced by BaselineJoinHashTable::codegenKey(), PerfectJoinHashTable::codegenMatchingSet(), and PerfectJoinHashTable::codegenSlot().
size_t get_table_cardinality | ( | shared::TableKey const & | table_key, |
Executor const * | executor | ||
) |
Definition at line 1412 of file ExpressionRewrite.cpp.
References CHECK, Catalog_Namespace::get_metadata_for_table(), get_temporary_table(), and shared::TableKey::table_id.
Referenced by anonymous_namespace{FromTableReordering.cpp}::get_join_qual_cost(), and translate_bounding_box_intersect_with_reordering().
Analyzer::ExpressionPtr rewrite_array_elements | ( | Analyzer::Expr const * | expr | ) |
Definition at line 775 of file ExpressionRewrite.cpp.
Referenced by anonymous_namespace{RelAlgExecutor.cpp}::translate_scalar_sources(), anonymous_namespace{RelAlgExecutor.cpp}::translate_scalar_sources_for_update(), and anonymous_namespace{RelAlgExecutor.cpp}::translate_targets().
Analyzer::ExpressionPtr rewrite_expr | ( | const Analyzer::Expr * | expr | ) |
Definition at line 779 of file ExpressionRewrite.cpp.
References rewrite_avg_window(), rewrite_sum_window(), and anonymous_namespace{ExpressionRewrite.cpp}::strip_likelihood().
Referenced by RelAlgExecutor::createFilterWorkUnit(), qual_to_conjunctive_form(), qual_to_disjunctive_form(), anonymous_namespace{RelAlgExecutor.cpp}::rewrite_quals(), QueryRewriter::rewriteConstrainedByIn(), anonymous_namespace{RelAlgExecutor.cpp}::translate_scalar_sources(), anonymous_namespace{RelAlgExecutor.cpp}::translate_scalar_sources_for_update(), and anonymous_namespace{RelAlgExecutor.cpp}::translate_targets().
bool self_join_not_covered_by_left_deep_tree | ( | const Analyzer::ColumnVar * | key_side, |
const Analyzer::ColumnVar * | val_side, | ||
const int | max_rte_covered | ||
) |
Definition at line 1390 of file ExpressionRewrite.cpp.
References Analyzer::ColumnVar::get_rte_idx(), and Analyzer::ColumnVar::getTableKey().
Referenced by BaselineJoinHashTable::codegenKey(), PerfectJoinHashTable::codegenMatchingSet(), and PerfectJoinHashTable::codegenSlot().
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 | ||
) |
Definition at line 1332 of file ExpressionRewrite.cpp.
References g_strip_join_covered_quals, and ScalarExprVisitor< T >::visit().
Referenced by RelAlgExecutionUnit::createCountAllExecutionUnit().
BoundingBoxIntersectJoinTranslationResult translate_bounding_box_intersect_with_reordering | ( | const std::shared_ptr< Analyzer::Expr > | expr, |
std::vector< InputDescriptor > & | input_descs, | ||
std::unordered_map< const RelAlgNode *, int > & | input_to_nest_level, | ||
std::vector< size_t > & | input_permutation, | ||
std::list< std::shared_ptr< const InputColDescriptor >> & | input_col_desc, | ||
const BoundingBoxIntersectJoinRewriteType | rewrite_type, | ||
Executor const * | executor | ||
) |
Definition at line 857 of file ExpressionRewrite.cpp.
References run_benchmark_import::args, BBOX_INTERSECT_JOIN, CHECK, CHECK_EQ, CHECK_GE, Analyzer::Expr::collect_rte_idx(), BoundingBoxIntersectJoinTranslationResult::converted_bbox_intersect_join_info, BoundingBoxIntersectJoinTranslationResult::createEmptyResult(), g_enable_hashjoin_many_to_many, get_table_cardinality(), Analyzer::ColumnVar::getColumnKey(), logger::INFO, is_constructed_point(), BoundingBoxIntersectJoinSupportedFunction::is_many_to_many_func(), BoundingBoxIntersectJoinSupportedFunction::is_range_join_rewrite_target_func(), BoundingBoxIntersectJoinConjunction::join_quals, kARRAY, kBBOX_INTERSECT, kBOOLEAN, kDOUBLE, kGEOGRAPHY, kLE, kONE, kPOINT, LOG, BoundingBoxIntersectJoinConjunction::quals, RANGE_JOIN, run_benchmark_import::res, BoundingBoxIntersectJoinSupportedFunction::ST_DISTANCE_sv, BoundingBoxIntersectJoinSupportedFunction::ST_DWITHIN_POINT_POINT_sv, BoundingBoxIntersectJoinSupportedFunction::ST_INTERSECTSBOX_sv, gpu_enabled::swap(), BoundingBoxIntersectJoinTranslationResult::swap_arguments, anonymous_namespace{ExpressionRewrite.cpp}::update_input_col_desc(), anonymous_namespace{ExpressionRewrite.cpp}::update_input_desc(), anonymous_namespace{ExpressionRewrite.cpp}::update_input_to_nest_lv(), ScalarExprVisitor< T >::visit(), VLOG, and logger::WARNING.
Referenced by convert_bbox_intersect_join().