OmniSciDB
a5dc49c757
|
#include "ExpressionRange.h"
#include "DateTimeTranslator.h"
#include "DateTimeUtils.h"
#include "DateTruncate.h"
#include "Descriptors/InputDescriptors.h"
#include "Execute.h"
#include "ExtractFromTime.h"
#include "GroupByAndAggregate.h"
#include "QueryPhysicalInputsCollector.h"
#include <algorithm>
#include <cfenv>
#include <cmath>
Go to the source code of this file.
Namespaces | |
anonymous_namespace{ExpressionRange.cpp} | |
Macros | |
#define | DEF_OPERATOR(fname, op) |
#define | FIND_STAT_FRAG(stat_name) |
Functions | |
void | apply_fp_qual (const Datum const_datum, const SQLTypes const_type, const SQLOps sql_op, ExpressionRange &qual_range) |
void | apply_int_qual (const Datum const_datum, const SQLTypes const_type, const SQLOps sql_op, ExpressionRange &qual_range) |
void | apply_hpt_qual (const Datum const_datum, const SQLTypes const_type, const int32_t const_dimen, const int32_t col_dimen, const SQLOps sql_op, ExpressionRange &qual_range) |
ExpressionRange | apply_simple_quals (const Analyzer::ColumnVar *col_expr, const ExpressionRange &col_range, const boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
ExpressionRange | getExpressionRange (const Analyzer::BinOper *expr, const std::vector< InputTableInfo > &query_infos, const Executor *, boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
ExpressionRange | getExpressionRange (const Analyzer::Constant *expr) |
ExpressionRange | getExpressionRange (const Analyzer::ColumnVar *col_expr, const std::vector< InputTableInfo > &query_infos, const Executor *executor, boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
ExpressionRange | getExpressionRange (const Analyzer::StringOper *string_oper_expr, const Executor *executor) |
ExpressionRange | getExpressionRange (const Analyzer::LikeExpr *like_expr) |
ExpressionRange | getExpressionRange (const Analyzer::CaseExpr *case_expr, const std::vector< InputTableInfo > &query_infos, const Executor *) |
ExpressionRange | getExpressionRange (const Analyzer::UOper *u_expr, const std::vector< InputTableInfo > &query_infos, const Executor *, boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
ExpressionRange | getExpressionRange (const Analyzer::ExtractExpr *extract_expr, const std::vector< InputTableInfo > &query_infos, const Executor *, boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
ExpressionRange | getExpressionRange (const Analyzer::DatetruncExpr *datetrunc_expr, const std::vector< InputTableInfo > &query_infos, const Executor *executor, boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
ExpressionRange | getExpressionRange (const Analyzer::WidthBucketExpr *width_bucket_expr, const std::vector< InputTableInfo > &query_infos, const Executor *executor, boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
ExpressionRange | getExpressionRange (const Analyzer::Expr *expr, const std::vector< InputTableInfo > &query_infos, const Executor *executor, boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> simple_quals) |
int64_t | anonymous_namespace{ExpressionRange.cpp}::scale_up_interval_endpoint (const int64_t endpoint, const SQLTypeInfo &ti) |
int64_t | anonymous_namespace{ExpressionRange.cpp}::get_conservative_datetrunc_bucket (const DatetruncField datetrunc_field) |
ExpressionRange | getLeafColumnRange (const Analyzer::ColumnVar *col_expr, const std::vector< InputTableInfo > &query_infos, const Executor *executor, const bool is_outer_join_proj) |
ExpressionRange | anonymous_namespace{ExpressionRange.cpp}::fpRangeFromDecimal (const ExpressionRange &arg_range, const int64_t scale, const SQLTypeInfo &target_ti) |
ExpressionRange | anonymous_namespace{ExpressionRange.cpp}::getDateTimePrecisionCastRange (const ExpressionRange &arg_range, const SQLTypeInfo &oper_ti, const SQLTypeInfo &target_ti) |
#define DEF_OPERATOR | ( | fname, | |
op | |||
) |
Definition at line 31 of file ExpressionRange.cpp.
#define FIND_STAT_FRAG | ( | stat_name | ) |
Definition at line 451 of file ExpressionRange.cpp.
Referenced by getLeafColumnRange().
void apply_fp_qual | ( | const Datum | const_datum, |
const SQLTypes | const_type, | ||
const SQLOps | sql_op, | ||
ExpressionRange & | qual_range | ||
) |
Definition at line 74 of file ExpressionRange.cpp.
References kEQ, kGE, kGT, kLE, and kLT.
Referenced by apply_simple_quals().
void apply_hpt_qual | ( | const Datum | const_datum, |
const SQLTypes | const_type, | ||
const int32_t | const_dimen, | ||
const int32_t | col_dimen, | ||
const SQLOps | sql_op, | ||
ExpressionRange & | qual_range | ||
) |
Definition at line 124 of file ExpressionRange.cpp.
References apply_int_qual(), Datum::bigintval, CHECK, and DateTimeUtils::get_timestamp_precision_scale().
Referenced by apply_simple_quals().
void apply_int_qual | ( | const Datum | const_datum, |
const SQLTypes | const_type, | ||
const SQLOps | sql_op, | ||
ExpressionRange & | qual_range | ||
) |
Definition at line 97 of file ExpressionRange.cpp.
References ExpressionRange::getIntMax(), ExpressionRange::getIntMin(), kEQ, kGE, kGT, kLE, kLT, ExpressionRange::setIntMax(), and ExpressionRange::setIntMin().
Referenced by apply_hpt_qual(), and apply_simple_quals().
ExpressionRange apply_simple_quals | ( | const Analyzer::ColumnVar * | col_expr, |
const ExpressionRange & | col_range, | ||
const boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 144 of file ExpressionRange.cpp.
References apply_fp_qual(), apply_hpt_qual(), apply_int_qual(), Double, Float, Analyzer::ColumnVar::getColumnKey(), and ExpressionRange::getType().
Referenced by getExpressionRange().
ExpressionRange getExpressionRange | ( | const Analyzer::BinOper * | expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 373 of file ExpressionRange.cpp.
References CHECK, Analyzer::BinOper::get_left_operand(), Analyzer::BinOper::get_optype(), Analyzer::BinOper::get_right_operand(), Analyzer::Expr::get_type_info(), Integer, Invalid, kDIVIDE, kMINUS, kMULTIPLY, kPLUS, ExpressionRange::makeIntRange(), ExpressionRange::makeInvalidRange(), and anonymous_namespace{ExpressionRange.cpp}::scale_up_interval_endpoint().
Referenced by CodeGenerator::checkExpressionRanges(), CodeGenerator::codegen(), anonymous_namespace{RelAlgExecutor.cpp}::decide_approx_count_distinct_implementation(), anonymous_namespace{GroupByAndAggregate.cpp}::get_expr_range_info(), anonymous_namespace{GroupByAndAggregate.cpp}::get_keyless_info(), getExpressionRange(), PerfectJoinHashTable::getInstance(), anonymous_namespace{QueryMemoryDescriptor.cpp}::pick_baseline_key_width(), and QueryRewriter::rewriteConstrainedByInImpl().
ExpressionRange getExpressionRange | ( | const Analyzer::Constant * | expr | ) |
Definition at line 408 of file ExpressionRange.cpp.
References Analyzer::Constant::get_constval(), Analyzer::Constant::get_is_null(), SQLTypeInfo::get_type(), Analyzer::Expr::get_type_info(), kBIGINT, kDATE, kDECIMAL, kDOUBLE, kFLOAT, kINT, kNUMERIC, kSMALLINT, kTIME, kTIMESTAMP, kTINYINT, ExpressionRange::makeDoubleRange(), ExpressionRange::makeFloatRange(), ExpressionRange::makeIntRange(), and ExpressionRange::makeInvalidRange().
ExpressionRange getExpressionRange | ( | const Analyzer::ColumnVar * | col_expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 634 of file ExpressionRange.cpp.
References apply_simple_quals(), CHECK_GE, CHECK_LT, Analyzer::ColumnVar::get_rte_idx(), Analyzer::ColumnVar::getColumnKey(), getLeafColumnRange(), and PhysicalInput::table_id.
ExpressionRange getExpressionRange | ( | const Analyzer::StringOper * | string_oper_expr, |
const Executor * | executor | ||
) |
Definition at line 655 of file ExpressionRange.cpp.
References CHECK, CHECK_NE, Analyzer::Expr::get_type_info(), Analyzer::StringOper::getChainedStringOpExprs(), ExpressionRange::makeIntRange(), ExpressionRange::makeInvalidRange(), Analyzer::StringOper::requiresPerRowTranslation(), RowSetMemoryOwner::SOURCE_UNION, and TRANSIENT_DICT_ID.
ExpressionRange getExpressionRange | ( | const Analyzer::LikeExpr * | like_expr | ) |
Definition at line 706 of file ExpressionRange.cpp.
References CHECK, Analyzer::LikeExpr::get_arg(), Analyzer::Expr::get_type_info(), inline_int_null_val(), and ExpressionRange::makeIntRange().
ExpressionRange getExpressionRange | ( | const Analyzer::CaseExpr * | case_expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor | ||
) |
Definition at line 714 of file ExpressionRange.cpp.
References CHECK, CHECK_EQ, Analyzer::CaseExpr::get_else_expr(), Analyzer::CaseExpr::get_expr_pair_list(), getExpressionRange(), Invalid, kBOOLEAN, ExpressionRange::makeInvalidRange(), and Null.
ExpressionRange getExpressionRange | ( | const Analyzer::UOper * | u_expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 819 of file ExpressionRange.cpp.
References gpu_enabled::accumulate(), CHECK, CHECK_EQ, Double, exp_to_scale(), Float, anonymous_namespace{ExpressionRange.cpp}::fpRangeFromDecimal(), Analyzer::UOper::get_operand(), Analyzer::UOper::get_optype(), Analyzer::Expr::get_type_info(), anonymous_namespace{ExpressionRange.cpp}::getDateTimePrecisionCastRange(), getExpressionRange(), Integer, Invalid, kCAST, kDATE, kDOUBLE, kENCODING_DICT, kFLOAT, kTIME, kUNNEST, ExpressionRange::makeDoubleRange(), ExpressionRange::makeFloatRange(), ExpressionRange::makeIntRange(), ExpressionRange::makeInvalidRange(), ExpressionRange::makeNullRange(), Analyzer::Expr::toString(), TRANSIENT_DICT_ID, and VLOG.
ExpressionRange getExpressionRange | ( | const Analyzer::ExtractExpr * | extract_expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 946 of file ExpressionRange.cpp.
References CHECK, ExtractFromTime(), Analyzer::ExtractExpr::get_field(), Analyzer::ExtractExpr::get_from_expr(), DateTimeUtils::get_timestamp_precision_scale(), Analyzer::Expr::get_type_info(), getExpressionRange(), ExpressionRange::getType(), Integer, Invalid, kDATEEPOCH, kDAY, kDOW, kDOY, kEPOCH, kHOUR, kISODOW, kMICROSECOND, kMILLISECOND, kMINUTE, kMONTH, kNANOSECOND, kQUARTER, kQUARTERDAY, kSECOND, kWEEK, kWEEK_SATURDAY, kWEEK_SUNDAY, kYEAR, ExpressionRange::makeIntRange(), and ExpressionRange::makeInvalidRange().
ExpressionRange getExpressionRange | ( | const Analyzer::DatetruncExpr * | datetrunc_expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 1018 of file ExpressionRange.cpp.
References anonymous_namespace{ExpressionRange.cpp}::get_conservative_datetrunc_bucket(), Analyzer::DatetruncExpr::get_field(), Analyzer::DatetruncExpr::get_from_expr(), DateTimeUtils::get_timestamp_precision_scale(), Analyzer::Expr::get_type_info(), DateTimeTranslator::getDateTruncConstantValue(), getExpressionRange(), Invalid, ExpressionRange::makeIntRange(), and ExpressionRange::makeInvalidRange().
ExpressionRange getExpressionRange | ( | const Analyzer::WidthBucketExpr * | width_bucket_expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 1043 of file ExpressionRange.cpp.
References CHECK, Analyzer::WidthBucketExpr::compute_bucket(), Double, Float, Analyzer::WidthBucketExpr::get_partition_count(), Analyzer::WidthBucketExpr::get_partition_count_val(), Analyzer::WidthBucketExpr::get_target_value(), getExpressionRange(), ExpressionRange::getFpMax(), ExpressionRange::getFpMin(), ExpressionRange::hasNulls(), Integer, Invalid, Analyzer::WidthBucketExpr::is_constant_expr(), ExpressionRange::makeIntRange(), run_benchmark_import::res, and width_bucket_expr().
ExpressionRange getExpressionRange | ( | const Analyzer::Expr * | expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
boost::optional< std::list< std::shared_ptr< Analyzer::Expr >>> | simple_quals | ||
) |
Definition at line 334 of file ExpressionRange.cpp.
References Analyzer::Expr::get_type_info(), getExpressionRange(), ExpressionRange::makeInvalidRange(), and ExpressionRange::typeSupportsRange().
ExpressionRange getLeafColumnRange | ( | const Analyzer::ColumnVar * | col_expr, |
const std::vector< InputTableInfo > & | query_infos, | ||
const Executor * | executor, | ||
const bool | is_outer_join_proj | ||
) |
Definition at line 521 of file ExpressionRange.cpp.
References CHECK, CHECK_EQ, CHECK_GT, shared::ColumnKey::column_id, dtDAY, extract_max_stat_fp_type(), extract_max_stat_int_type(), extract_min_stat_fp_type(), extract_min_stat_int_type(), FIND_STAT_FRAG, anonymous_namespace{ExpressionRange.cpp}::get_conservative_datetrunc_bucket(), SQLTypeInfo::get_elem_type(), get_logical_type_info(), Analyzer::Expr::get_type_info(), Analyzer::ColumnVar::getColumnKey(), Analyzer::ColumnVar::getTableKey(), SQLTypeInfo::is_array(), kBIGINT, kBOOLEAN, kCHAR, kDATE, kDECIMAL, kDOUBLE, kENCODING_DICT, kFLOAT, kINT, kNUMERIC, kSMALLINT, kTEXT, kTIME, kTIMESTAMP, kTINYINT, kVARCHAR, ExpressionRange::makeDoubleRange(), ExpressionRange::makeFloatRange(), ExpressionRange::makeIntRange(), and ExpressionRange::makeInvalidRange().
Referenced by Executor::computeColRangesCache(), and getExpressionRange().