17 #ifndef QUERYENGINE_EXPRESSIONRANGE_H
18 #define QUERYENGINE_EXPRESSIONRANGE_H
20 #include "../Analyzer/Analyzer.h"
22 #include <boost/multiprecision/cpp_int.hpp>
23 #include <boost/optional.hpp>
26 boost::multiprecision::cpp_int_backend<64,
28 boost::multiprecision::signed_magnitude,
29 boost::multiprecision::checked,
36 boost::multiprecision::cpp_int_backend<15,
38 boost::multiprecision::signed_magnitude,
39 boost::multiprecision::checked,
60 const int64_t int_max,
62 const bool has_nulls) {
68 const bool has_nulls) {
74 const bool has_nulls) {
157 std::ostringstream oss;
178 const int64_t int_max_in,
179 const int64_t bucket,
180 const bool has_nulls_in)
188 const double fp_min_in,
189 const double fp_max_in,
190 const bool has_nulls_in)
207 template <
class T,
class BinOp>
211 std::vector<T> limits{bin_op(getMin<T>(*
this), getMin<T>(other)),
212 bin_op(getMin<T>(*
this), getMax<T>(other)),
213 bin_op(getMax<T>(*
this), getMin<T>(other)),
214 bin_op(getMax<T>(*
this), getMax<T>(other))};
218 switch (result.
type_) {
220 result.
int_min_ = *std::min_element(limits.begin(), limits.end());
221 result.
int_max_ = *std::max_element(limits.begin(), limits.end());
226 result.
fp_min_ = *std::min_element(limits.begin(), limits.end());
227 result.
fp_max_ = *std::max_element(limits.begin(), limits.end());
254 return e.getIntMin();
269 return e.getIntMax();
284 const SQLTypes type_info) noexcept {
287 return datum.boolval;
289 return datum.tinyintval;
291 return datum.smallintval;
295 return datum.bigintval;
299 return datum.bigintval;
302 return datum.bigintval;
315 return datum.floatval;
317 return datum.doubleval;
334 const int32_t const_dimen,
335 const int32_t col_dimen,
342 const boost::optional<std::list<std::shared_ptr<Analyzer::Expr>>> = boost::none);
348 const std::vector<InputTableInfo>&,
350 const bool is_outer_join_proj);
354 const std::vector<InputTableInfo>&,
356 boost::optional<std::list<std::shared_ptr<Analyzer::Expr>>> = boost::none);
358 #endif // QUERYENGINE_EXPRESSIONRANGE_H
int64_t getIntMin() const
std::string toString() const
ExpressionRange binOp(const ExpressionRange &other, const BinOp &bin_op) const
static ExpressionRange makeNullRange()
bool operator==(const ExpressionRange &other) const
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 64, 64, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void >> checked_int64_t
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)
double getMax< double >(const ExpressionRange &e)
void apply_int_qual(const Datum const_datum, const SQLTypes const_type, const SQLOps sql_op, ExpressionRange &qual_range)
ExpressionRange(const ExpressionRangeType type)
T getMax(const ExpressionRange &other)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 15, 15, boost::multiprecision::signed_magnitude, boost::multiprecision::checked, void >> checked_int16_t
ExpressionRange operator-(const ExpressionRange &other) const
T get_value_from_datum(const Datum datum, const SQLTypes type_info) noexcept
void setIntMin(const int64_t int_min)
static ExpressionRange makeFloatRange(const float fp_min, const float fp_max, const bool has_nulls)
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)
T getMin(const ExpressionRange &other)
ExpressionRange(const ExpressionRangeType type, const double fp_min_in, const double fp_max_in, const bool has_nulls_in)
ExpressionRange operator+(const ExpressionRange &other) const
ExpressionRangeType type_
ExpressionRange operator||(const ExpressionRange &other) const
void apply_fp_qual(const Datum const_datum, const SQLTypes const_type, const SQLOps sql_op, ExpressionRange &qual_range)
void setIntInvalidRange()
ExpressionRange getLeafColumnRange(const Analyzer::ColumnVar *col_expr, const std::vector< InputTableInfo > &query_infos, const Executor *executor, const bool is_outer_join_proj)
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)
bool g_enable_smem_group_by true
static ExpressionRange makeIntRange(const int64_t int_min, const int64_t int_max, const int64_t bucket, const bool has_nulls)
int64_t getMin< int64_t >(const ExpressionRange &e)
double getMin< double >(const ExpressionRange &e)
static ExpressionRange makeDoubleRange(const double fp_min, const double fp_max, const bool has_nulls)
float getMin< float >(const ExpressionRange &e)
ExpressionRange operator/(const ExpressionRange &other) const
void setIntMax(const int64_t int_max)
ExpressionRange(const int64_t int_min_in, const int64_t int_max_in, const int64_t bucket, const bool has_nulls_in)
ExpressionRangeType getType() const
int64_t getIntMax() const
bool g_enable_watchdog false
int64_t getBucket() const
void setFpMax(const double fp_max)
float getMax< float >(const ExpressionRange &e)
static bool typeSupportsRange(const SQLTypeInfo &ti)
void setFpMin(const double fp_min)
static ExpressionRange makeInvalidRange()
int64_t getMax< int64_t >(const ExpressionRange &e)
ExpressionRange operator*(const ExpressionRange &other) const