diff options
Diffstat (limited to 'sql/item_sum.h')
-rw-r--r-- | sql/item_sum.h | 80 |
1 files changed, 61 insertions, 19 deletions
diff --git a/sql/item_sum.h b/sql/item_sum.h index b400ebd5f80..50e41990b13 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -384,7 +384,9 @@ protected: Item **orig_args, *tmp_orig_args[2]; static size_t ram_limitation(THD *thd); - +public: + // Methods used by ColumnStore + Item **get_orig_args() const { return orig_args; } public: void mark_as_sum_func(); @@ -511,7 +513,12 @@ public: } virtual void make_unique() { force_copy_fields= TRUE; } Item *get_tmp_table_item(THD *thd); - Field *create_tmp_field(bool group, TABLE *table); + virtual Field *create_tmp_field(bool group, TABLE *table); + Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src, + const Tmp_field_param *param) + { + return create_tmp_field(param->group(), table); + } virtual bool collect_outer_ref_processor(void *param); bool init_sum_func_check(THD *thd); bool check_sum_func(THD *thd, Item **ref); @@ -578,6 +585,8 @@ public: void mark_as_window_func_sum_expr() { window_func_sum_expr_flag= true; } bool is_window_func_sum_expr() { return window_func_sum_expr_flag; } virtual void setup_caches(THD *thd) {}; + + bool with_sum_func() const { return true; } }; @@ -735,9 +744,9 @@ public: longlong val_int() { return val_int_from_real(); /* Real as default */ } String *val_str(String*str); my_decimal *val_decimal(my_decimal *); - bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) { - return type_handler()->Item_get_date(this, ltime, fuzzydate); + return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } void reset_field(); }; @@ -1060,9 +1069,10 @@ protected: double val_real(); longlong val_int(); my_decimal *val_decimal(my_decimal *); - bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate); + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); void reset_field(); String *val_str(String *); + bool val_native(THD *thd, Native *); const Type_handler *real_type_handler() const { return get_arg(0)->real_type_handler(); @@ -1356,7 +1366,7 @@ public: void update_field(){DBUG_ASSERT(0);} void clear(); void cleanup(); - bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) { return execute() || sp_result_field->get_date(ltime, fuzzydate); } @@ -1384,17 +1394,21 @@ public: decimals= item->decimals; max_length= item->max_length; unsigned_flag= item->unsigned_flag; - fixed= true; } table_map used_tables() const { return (table_map) 1L; } + Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src, + const Tmp_field_param *param) + { + return create_tmp_field_ex_simple(table, src, param); + } void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); } bool check_vcol_func_processor(void *arg) { return mark_unsupported_function(name.str, arg, VCOL_IMPOSSIBLE); } - bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) { - return type_handler()->Item_get_date(this, ltime, fuzzydate); + return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } }; @@ -1439,9 +1453,18 @@ public: dec_bin_size(item->dec_bin_size) { } const Type_handler *type_handler() const { return &type_handler_newdecimal; } - double val_real() { return val_real_from_decimal(); } - longlong val_int() { return val_int_from_decimal(); } - String *val_str(String *str) { return val_string_from_decimal(str); } + double val_real() + { + return VDec(this).to_double(); + } + longlong val_int() + { + return VDec(this).to_longlong(unsigned_flag); + } + String *val_str(String *str) + { + return VDec(this).to_string_round(str, decimals); + } my_decimal *val_decimal(my_decimal *); Item *get_copy(THD *thd) { return get_item_copy<Item_avg_field_decimal>(thd, this); } @@ -1541,13 +1564,15 @@ public: void clear(); bool add(); + bool supports_removal() const; + void remove(); void reset_field() {}; void update_field() {}; void cleanup(); virtual void print(String *str, enum_query_type query_type); - bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) { - return type_handler()->Item_get_date(this, ltime, fuzzydate); + return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); } }; @@ -1645,9 +1670,18 @@ public: Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item) :Item_udf_sum(thd, item) {} - String *val_str(String *); - double val_real(); - longlong val_int(); + String *val_str(String *str) + { + return VDec(this).to_string_round(str, decimals); + } + double val_real() + { + return VDec(this).to_double(); + } + longlong val_int() + { + return VDec(this).to_longlong(unsigned_flag); + } my_decimal *val_decimal(my_decimal *); const Type_handler *type_handler() const { return &type_handler_newdecimal; } bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } @@ -1797,6 +1831,14 @@ class Item_func_group_concat : public Item_sum element_count count __attribute__((unused)), void* item_arg); public: + // Methods used by ColumnStore + bool get_distinct() const { return distinct; } + uint get_count_field() const { return arg_count_field; } + uint get_order_field() const { return arg_count_order; } + const String* get_separator() const { return separator; } + ORDER** get_order() const { return order; } + +public: Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, bool is_distinct, List<Item> *is_select, const SQL_I_List<ORDER> &is_order, String *is_separator, @@ -1845,9 +1887,9 @@ public: { return val_decimal_from_string(decimal_value); } - bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) { - return get_date_from_string(ltime, fuzzydate); + return get_date_from_string(thd, ltime, fuzzydate); } String* val_str(String* str); Item *copy_or_same(THD* thd); |