1#ifndef ITEM_SUM_INCLUDED
2#define ITEM_SUM_INCLUDED
54#include "mysqld_error.h"
576 if (item ==
nullptr)
return nullptr;
600 bool eq(
const Item *item,
bool binary_cmp)
const override;
794 snprintf(buff,
sizeof(buff),
"%s as window function",
func_name());
907 void clear()
override;
909 void endup()
override;
1002 return static_cast<double>(
val_int());
1046 void clear()
override;
1047 bool add()
override;
1067 void clear()
override;
1068 bool add()
override;
1143 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1207 return "sum_bit_field";
1230 template <
typename... Args>
1232 Args &&...parent_args);
1268 const char *
func_name()
const override {
return "json_arrayagg"; }
1269 void clear()
override;
1270 bool add()
override;
1304 const char *
func_name()
const override {
return "json_objectagg"; }
1305 void clear()
override;
1306 bool add()
override;
1330 void clear()
override;
1331 bool add()
override;
1369 return "variance_field";
1373 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1467 void clear()
override;
1468 bool add()
override;
1476 return sample ?
"var_samp" :
"variance";
1504 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1524 return sample ?
"stddev_samp" :
"std";
1662 void clear()
override;
1688 bool add()
override;
1838 void clear()
override;
1860 bool add()
override;
1915 const char *
func_name()
const override {
return "bit_and"; }
1927 const char *
func_name()
const override {
return "bit_xor"; }
1962 if (
udf.
fix_fields(thd,
this, this->arg_count, this->args))
return true;
1968 void clear()
override;
1969 bool add()
override;
2038 const char *end_not_used;
2042 &end_not_used, &err_not_used)
2053 return cs->cset->strtoll10(
cs, res->
ptr(), &
end, &err_not_used);
2169 const char *
func_name()
const override {
return "group_concat"; }
2172 void clear()
override;
2173 bool add()
override;
2184 const char *end_ptr = res->
ptr() + res->
length();
2212 context = pointer_cast<Item_ident::Change_context *>(arg)->m_context;
2276 const char *
func_name()
const override {
return "row_number"; }
2289 void clear()
override;
2324 return m_dense ?
"dense_rank" :
"rank";
2347 void clear()
override;
2360 const char *
func_name()
const override {
return "cume_dist"; }
2401 const char *
func_name()
const override {
return "percent_rank"; }
2413 void clear()
override;
2503 void clear()
override;
2572 return m_is_first ?
"first_value" :
"last_value";
2580 void clear()
override;
2641 const char *
func_name()
const override {
return "nth_value"; }
2648 void clear()
override;
2699 const char *
func_name()
const override {
return "grouping"; }
2718 :
Item_sum((*sum_func_per_level)[0]),
2720 args = (*THR_MALLOC)->ArrayAlloc<
Item *>(sum_func_per_level->
size());
2722 for (
Item &item : *sum_func_per_level) {
2741 const char *
func_name()
const override {
return "rollup_sum_switcher"; }
2758 void clear()
override;
2782 Item *ret =
nullptr;
2801 return down_cast<Item_sum *>(
args[i]);
2846 return aggr ? false :
true;
2864 bool add()
override;
2869 void clear()
override;
2870 const char *
func_name()
const override {
return "st_collect"; }
The distinct aggregator.
Definition: item_sum.h:809
uint tree_key_length
Definition: item_sum.h:862
uint32 * field_lengths
Definition: item_sum.h:839
bool arg_is_null(bool use_null_value) override
NULLness of being-aggregated argument.
Definition: item_sum.cc:2148
bool endup_done
Definition: item_sum.h:820
Const_distinct
Definition: item_sum.h:864
@ CONST_NULL
Set to true if the result is known to be always NULL.
Definition: item_sum.h:875
@ CONST_NOT_NULL
Set to true if count distinct is on only const items.
Definition: item_sum.h:882
@ NOT_CONST
Definition: item_sum.h:865
static int composite_key_cmp(const void *arg, const void *a, const void *b)
Correctly compare composite keys.
Definition: item_sum.cc:958
void endup() override
Calculate the aggregate function value.
Definition: item_sum.cc:1330
~Aggregator_distinct() override
Definition: item_sum.cc:2098
bool use_distinct_values
When feeding back the data in endup() from Unique/temp table back to Item_sum::add() methods we must ...
Definition: item_sum.h:893
double arg_val_real() override
Floating point value of being-aggregated argument.
Definition: item_sum.cc:2143
void clear() override
Invalidate calculated value and clear the distinct rows.
Definition: item_sum.cc:1229
bool setup(THD *) override
Called before feeding the first row.
Definition: item_sum.cc:1029
bool unique_walk_function(void *element)
Aggregate a distinct row from the distinct hash table.
Definition: item_sum.cc:2091
Unique * tree
Definition: item_sum.h:854
Temp_table_param * tmp_table_param
Definition: item_sum.h:845
bool add() override
Process incoming row.
Definition: item_sum.cc:1261
TABLE * table
Definition: item_sum.h:831
Aggregator_type Aggrtype() override
Definition: item_sum.h:904
my_decimal * arg_val_decimal(my_decimal *value) override
Decimal value of being-aggregated argument.
Definition: item_sum.cc:2138
enum Aggregator_distinct::Const_distinct const_distinct
Aggregator_distinct(Item_sum *sum)
Definition: item_sum.h:896
The pass-through aggregator.
Definition: item_sum.h:923
void clear() override
Called when we need to wipe out all the data from the aggregator: all the values accumulated and all ...
Definition: item_sum.h:929
Aggregator_simple(Item_sum *sum)
Definition: item_sum.h:925
bool setup(THD *thd) override
Called before adding the first row.
Definition: item_sum.h:928
Aggregator_type Aggrtype() override
Definition: item_sum.h:926
my_decimal * arg_val_decimal(my_decimal *value) override
Decimal value of being-aggregated argument.
Definition: item_sum.cc:2115
void endup() override
Called when there are no more data and the final value is to be retrieved.
Definition: item_sum.h:931
double arg_val_real() override
Floating point value of being-aggregated argument.
Definition: item_sum.cc:2119
bool add() override
Called when there's a new value to be aggregated.
Definition: item_sum.h:930
bool arg_is_null(bool use_null_value) override
NULLness of being-aggregated argument.
Definition: item_sum.cc:2123
The abstract base class for the Aggregator_* classes.
Definition: item_sum.h:101
Item_sum * item_sum
Definition: item_sum.h:113
virtual bool arg_is_null(bool use_null_value)=0
NULLness of being-aggregated argument.
Aggregator_type
Definition: item_sum.h:119
@ SIMPLE_AGGREGATOR
Definition: item_sum.h:119
@ DISTINCT_AGGREGATOR
Definition: item_sum.h:119
virtual bool add()=0
Called when there's a new value to be aggregated.
virtual void endup()=0
Called when there are no more data and the final value is to be retrieved.
virtual Aggregator_type Aggrtype()=0
virtual ~Aggregator()=default
virtual my_decimal * arg_val_decimal(my_decimal *value)=0
Decimal value of being-aggregated argument.
virtual void clear()=0
Called when we need to wipe out all the data from the aggregator: all the values accumulated and all ...
Aggregator(Item_sum *arg)
Definition: item_sum.h:116
virtual double arg_val_real()=0
Floating point value of being-aggregated argument.
virtual bool setup(THD *)=0
Called before adding the first row.
Definition: item_cmpfunc.h:140
void set(const DTCollation &dt)
Definition: item.h:195
Definition: item_sum.h:1173
const char * func_name() const override
Definition: item_sum.h:1183
uint prec_increment
Definition: item_sum.h:1176
uint f_precision
Definition: item_sum.h:1175
uint dec_bin_size
Definition: item_sum.h:1175
uint f_scale
Definition: item_sum.h:1175
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3684
String * val_str(String *) override
Definition: item_sum.cc:3699
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1182
enum Type type() const override
Definition: item_sum.h:1178
double val_real() override
Definition: item_sum.cc:3669
Item_avg_field(Item_result res_type, Item_sum_avg *item)
Definition: item_sum.cc:3650
CUME_DIST window function, cf.
Definition: item_sum.h:2354
Item_cume_dist(const POS &pos, PT_window *w)
Definition: item_sum.h:2358
Item_non_framing_wf super
Definition: item_sum.h:2355
double val_real() override
Definition: item_sum.cc:4877
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2361
void clear() override
Definition: item_sum.h:2372
const char * func_name() const override
Definition: item_sum.h:2360
bool needs_partition_cardinality() const override
Return true if we need to make two passes over the rows in the partition - either because we need the...
Definition: item_sum.h:2371
String * val_str(String *) override
Definition: item_sum.cc:4897
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:4867
longlong val_int() override
Definition: item_sum.cc:4889
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2363
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:4901
Item_result result_type() const override
Definition: item_sum.h:2377
FIRST_VALUE/LAST_VALUE window functions, cf.
Definition: item_sum.h:2553
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2575
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5105
void reset_field() override
Definition: item_sum.h:2594
const char * func_name() const override
Definition: item_sum.h:2571
bool setup_first_last()
Definition: item_sum.cc:5142
double val_real() override
Definition: item_sum.cc:5191
String * val_str(String *str) override
Definition: item_sum.cc:5246
void update_after_wf_arguments_changed(THD *thd) override
Signal to the function that its arguments may have changed, and that any internal caches etc.
Definition: item_sum.cc:5159
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5091
bool compute()
Core logic of FIRST/LAST_VALUE window functions.
Definition: item_sum.cc:5163
int64 cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2558
Item_result m_hybrid_type
Definition: item_sum.h:2556
enum Item_result result_type() const override
Definition: item_sum.h:2583
Item_cache * m_value
Definition: item_sum.h:2557
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5222
void update_field() override
Definition: item_sum.h:2595
enum_null_treatment m_null_treatment
Definition: item_sum.h:2555
Item_sum super
Definition: item_sum.h:2559
void clear() override
Definition: item_sum.cc:5153
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2603
void split_sum_func(THD *thd, Ref_item_array ref_item_array, mem_root_deque< Item * > *fields) override
See comments in Item_cmp_func::split_sum_func()
Definition: item_sum.cc:5134
bool add() override
Definition: item_sum.h:2596
Item_first_last_value(const POS &pos, bool first, Item *a, enum_null_treatment null_treatment, PT_window *w)
Definition: item_sum.h:2562
bool m_is_first
if true, the function is FIRST_VALUE, else LAST_VALUE
Definition: item_sum.h:2554
longlong val_int() override
Definition: item_sum.cc:5181
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5232
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5212
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5115
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5201
Definition: item_sum.h:2100
void clear() override
Definition: item_sum.cc:4345
bool m_result_finalized
True if result has been written to output buffer.
Definition: item_sum.h:2139
String result
Definition: item_sum.h:2115
Item_func_group_concat * original
Following is 0 normal object and pointer to original one for copy (to correctly free resources)
Definition: item_sum.h:2144
longlong val_int() override
Definition: item_sum.h:2180
const String * get_separator_str() const noexcept
Definition: item_sum.h:2198
uint32_t get_group_concat_max_len() const noexcept
Definition: item_sum.h:2199
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_sum.h:2187
friend int dump_leaf_key(void *key_arg, element_count count, void *item_arg)
Append data from current leaf to item->result.
Definition: item_sum.cc:4092
uint row_count
Definition: item_sum.h:2130
void make_unique() override
Definition: item_sum.cc:4631
bool change_context_processor(uchar *arg) override
Definition: item_sum.h:2211
bool setup(THD *thd) override
Definition: item_sum.cc:4500
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_sum.cc:4220
Item_sum super
Definition: item_sum.h:2101
bool distinct
True if GROUP CONCAT has the DISTINCT attribute.
Definition: item_sum.h:2104
TABLE * table
Temporary table used to perform group concat.
Definition: item_sum.h:2128
friend int group_concat_key_cmp_with_distinct(const void *arg, const void *key1, const void *key2)
Compares the values for fields in expr list of GROUP_CONCAT.
Definition: item_sum.cc:4014
double val_real() override
Definition: item_sum.cc:4639
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2168
String * val_str(String *str) override
Definition: item_sum.cc:4646
friend int group_concat_key_cmp_with_order(const void *arg, const void *key1, const void *key2)
function of sort for syntax: GROUP_CONCAT(expr,... ORDER BY col,... )
Definition: item_sum.cc:4049
bool force_copy_fields
Definition: item_sum.h:2137
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:4408
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2190
Unique * unique_filter
If DISTINCT is used with this GROUP_CONCAT, this member is used to filter out duplicates.
Definition: item_sum.h:2126
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2216
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:4343
Mem_root_array< ORDER > order_array
Definition: item_sum.h:2129
TREE tree_base
Definition: item_sum.h:2116
void update_field() override
Definition: item_sum.h:2175
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:4671
Temp_table_param * tmp_table_param
Describes the temporary table used to perform group concat.
Definition: item_sum.h:2114
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:4272
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:4335
const char * func_name() const override
Definition: item_sum.h:2169
Item_result result_type() const override
Definition: item_sum.h:2170
Field * make_string_field(TABLE *table_arg) const override
Create a field to hold a string value from an item.
Definition: item_sum.cc:4302
uint m_order_arg_count
The number of ORDER BY items.
Definition: item_sum.h:2106
TREE * tree
Definition: item_sum.h:2117
Item_func_group_concat(const POS &pos, bool is_distinct, PT_item_list *select_list, PT_order_list *opt_order_list, String *separator, PT_window *w)
Constructor of Item_func_group_concat.
Definition: item_sum.cc:4182
bool has_distinct() const noexcept
Definition: item_sum.h:2197
bool add() override
Definition: item_sum.cc:4357
Name_resolution_context * context
Resolver context, points to containing query block.
Definition: item_sum.h:2110
void reset_field() override
Definition: item_sum.h:2174
uint m_field_arg_count
The number of selected items, aka the concat field list.
Definition: item_sum.h:2108
uint group_concat_max_len
The maximum permitted result length in bytes as set in group_concat_max_len system variable.
Definition: item_sum.h:2135
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2193
bool warning_for_row
Definition: item_sum.h:2136
String * separator
String containing separator between group items.
Definition: item_sum.h:2112
~Item_func_group_concat() override
Definition: item_sum.h:2161
const Mem_root_array< ORDER > & get_order_array() const noexcept
Definition: item_sum.h:2202
Class for implementation of the GROUPING function.
Definition: item_sum.h:2694
bool aggregate_check_group(uchar *arg) override
This function is expected to check if GROUPING function with its arguments is "group-invariant".
Definition: item_sum.cc:6275
longlong val_int() override
Evaluation of the GROUPING function.
Definition: item_sum.cc:6224
Item_func_grouping(const POS &pos, PT_item_list *a)
Definition: item_sum.h:2696
const char * func_name() const override
Definition: item_sum.h:2699
bool fix_fields(THD *thd, Item **ref) override
Resolve the fields in the GROUPING function.
Definition: item_sum.cc:6169
bool aggregate_check_distinct(uchar *arg) override
Used by Distinct_check::check_query to determine whether an error should be returned if the GROUPING ...
Definition: item_sum.cc:6245
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_sum.cc:6287
enum Functype functype() const override
Definition: item_sum.h:2700
Definition: item_func.h:102
Item ** args
Array of pointers to arguments.
Definition: item_func.h:109
virtual Item * get_arg(uint i)
Get the i'th argument of the function that this object represents.
Definition: item_func.h:445
Functype
Definition: item_func.h:185
@ GROUPING_FUNC
Definition: item_func.h:238
virtual uint argument_count() const
Definition: item_func.h:133
table_map used_tables_cache
Value used in calculation of result of used_tables()
Definition: item_func.h:171
bool param_type_is_default(THD *thd, uint start, uint end, uint step, enum_field_types def)
For arguments of this Item_func ("args" array), in range [start, start+step, start+2*step,...
Definition: item_func.cc:519
bool propagate_type(THD *thd, const Type_properties &type) override
Default implementation for all functions: Propagate base_item's type into all arguments.
Definition: item_func.cc:495
Item ** arguments() const
Definition: item_func.h:134
virtual void fix_num_length_and_dec()
Definition: item_func.cc:837
const char * original_db_name() const
Definition: item.h:4054
void set_original_field_name(const char *name_arg)
Definition: item.h:4051
const char * original_table_name() const
Definition: item.h:4055
Definition: item_func.h:935
LEAD/LAG window functions, cf.
Definition: item_sum.h:2461
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5517
bool has_value() const
Definition: item_sum.h:2534
bool m_is_lead
if true, the function is LEAD, else LAG
Definition: item_sum.h:2463
bool needs_partition_cardinality() const override
Return true if we need to make two passes over the rows in the partition - either because we need the...
Definition: item_sum.h:2518
const char * func_name() const override
Definition: item_sum.h:2495
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5638
void set_use_default(bool value)
Definition: item_sum.h:2536
String * val_str(String *str) override
Definition: item_sum.cc:5630
bool m_use_default
execution state: use default value for current row
Definition: item_sum.h:2478
enum Item_result result_type() const override
Definition: item_sum.h:2507
Item_cache * m_default
Definition: item_sum.h:2467
bool compute()
Core logic of LEAD/LAG window functions.
Definition: item_sum.cc:5665
Item_lead_lag(const POS &pos, bool lead, PT_item_list *opt_list, enum_null_treatment null_treatment, PT_window *w)
Definition: item_sum.h:2482
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5577
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2498
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5647
enum_null_treatment m_null_treatment
Definition: item_sum.h:2462
void clear() override
Definition: item_sum.cc:5589
bool use_default() const
Definition: item_sum.h:2537
bool m_has_value
Execution state: if set, we already have a value for current row.
Definition: item_sum.h:2477
longlong val_int() override
Definition: item_sum.cc:5601
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5617
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5526
Item_result m_hybrid_type
Definition: item_sum.h:2465
int64 m_n
canonicalized offset value
Definition: item_sum.h:2464
double val_real() override
Definition: item_sum.cc:5609
void set_has_value(bool value)
Definition: item_sum.h:2533
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5464
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5655
bool setup_lead_lag()
Definition: item_sum.cc:5561
Item_cache * m_value
Definition: item_sum.h:2466
void split_sum_func(THD *thd, Ref_item_array ref_item_array, mem_root_deque< Item * > *fields) override
See comments in Item_cmp_func::split_sum_func()
Definition: item_sum.cc:5554
Item_non_framing_wf super
Definition: item_sum.h:2479
void update_after_wf_arguments_changed(THD *thd) override
Signal to the function that its arguments may have changed, and that any internal caches etc.
Definition: item_sum.cc:5596
Common parent class for window functions that always work on the entire partition,...
Definition: item_sum.h:2232
Item_non_framing_wf(const POS &pos, PT_window *w)
Definition: item_sum.h:2236
bool add() override
Definition: item_sum.h:2253
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2247
Item_non_framing_wf(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2237
Item_non_framing_wf(const POS &pos, PT_item_list *opt_list, PT_window *w)
Definition: item_sum.h:2239
Item_sum super
Definition: item_sum.h:2233
Item_non_framing_wf(THD *thd, Item_non_framing_wf *i)
Definition: item_sum.h:2241
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2243
void update_field() override
Definition: item_sum.h:2252
void reset_field() override
Definition: item_sum.h:2251
bool framing() const override
All aggregates are framing, i.e.
Definition: item_sum.h:2260
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:4707
NTH_VALUE window function, cf.
Definition: item_sum.h:2619
int64 m_cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2626
void update_field() override
Definition: item_sum.h:2666
bool compute()
Core logic of NTH_VALUE window functions.
Definition: item_sum.cc:5357
String * val_str(String *str) override
Definition: item_sum.cc:5424
Item_sum super
Definition: item_sum.h:2628
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:4981
enum Item_result result_type() const override
Definition: item_sum.h:2654
Item_result m_hybrid_type
Definition: item_sum.h:2623
void split_sum_func(THD *thd, Ref_item_array ref_item_array, mem_root_deque< Item * > *fields) override
See comments in Item_cmp_func::split_sum_func()
Definition: item_sum.cc:5309
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5410
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5444
bool setup_nth()
Definition: item_sum.cc:5316
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5269
enum_field_types m_hybrid_field_type
Definition: item_sum.h:2624
int64 m_n
The N of the function.
Definition: item_sum.h:2621
double val_real() override
Definition: item_sum.cc:5400
bool m_from_last
true iff FROM_LAST was specified
Definition: item_sum.h:2622
Item_cache * m_value
Definition: item_sum.h:2625
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5454
enum_null_treatment m_null_treatment
Definition: item_sum.h:2620
void reset_field() override
Definition: item_sum.h:2665
longlong val_int() override
Definition: item_sum.cc:5390
Item_nth_value(const POS &pos, PT_item_list *a, bool from_last, enum_null_treatment null_treatment, PT_window *w)
Definition: item_sum.h:2631
void clear() override
Definition: item_sum.cc:5327
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5256
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2642
void update_after_wf_arguments_changed(THD *thd) override
Signal to the function that its arguments may have changed, and that any internal caches etc.
Definition: item_sum.cc:5333
bool add() override
Definition: item_sum.h:2667
const char * func_name() const override
Definition: item_sum.h:2641
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5434
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5337
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2674
NTILE window function, cf.
Definition: item_sum.h:2424
void clear() override
Definition: item_sum.h:2454
Item_non_framing_wf super
Definition: item_sum.h:2425
String * val_str(String *) override
Definition: item_sum.cc:5060
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2437
const char * func_name() const override
Definition: item_sum.h:2434
bool needs_partition_cardinality() const override
Return true if we need to make two passes over the rows in the partition - either because we need the...
Definition: item_sum.h:2455
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5075
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:4999
double val_real() override
Definition: item_sum.cc:5055
longlong val_int() override
Definition: item_sum.cc:5005
longlong m_value
Definition: item_sum.h:2426
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:5062
Item_ntile(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2429
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2435
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5067
Item_result result_type() const override
Definition: item_sum.h:2453
PERCENT_RANK window function, cf.
Definition: item_sum.h:2383
String * val_str(String *) override
Definition: item_sum.cc:4964
Item_percent_rank(const POS &pos, PT_window *w)
Definition: item_sum.h:2394
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2386
const char * func_name() const override
Definition: item_sum.h:2401
Item_result result_type() const override
Definition: item_sum.h:2418
~Item_percent_rank() override
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:4906
ulonglong m_peers
Needed to make PERCENT_RANK same for peers.
Definition: item_sum.h:2387
double val_real() override
Definition: item_sum.cc:4930
Item_non_framing_wf super
Definition: item_sum.h:2384
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2404
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2402
bool needs_partition_cardinality() const override
Return true if we need to make two passes over the rows in the partition - either because we need the...
Definition: item_sum.h:2411
bool m_last_peer_visited
Set when the last peer has been visited.
Definition: item_sum.h:2391
void clear() override
Definition: item_sum.cc:4973
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:4968
longlong val_int() override
Definition: item_sum.cc:4956
RANK or DENSE_RANK window function, cf.
Definition: item_sum.h:2303
Item_result result_type() const override
Definition: item_sum.h:2348
void update_after_wf_arguments_changed(THD *thd) override
Signal to the function that its arguments may have changed, and that any internal caches etc.
Definition: item_sum.cc:4762
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:4786
ulonglong m_duplicates
Needed to make RANK different from DENSE_RANK.
Definition: item_sum.h:2308
bool m_dense
If true, the object represents DENSE_RANK.
Definition: item_sum.h:2305
longlong val_int() override
Definition: item_sum.cc:4804
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2327
~Item_rank() override
Definition: item_sum.cc:4860
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2331
Item_rank(const POS &pos, bool dense, PT_window *w)
Definition: item_sum.h:2312
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4839
const char * func_name() const override
Definition: item_sum.h:2323
double val_real() override
Definition: item_sum.cc:4832
String * val_str(String *) override
Definition: item_sum.cc:4837
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2307
void clear() override
Clear state for a new partition.
Definition: item_sum.cc:4844
Mem_root_array< Cached_item * > m_previous
Values of previous row's ORDER BY items.
Definition: item_sum.h:2310
Item_non_framing_wf super
Definition: item_sum.h:2304
Item with result field.
Definition: item.h:5628
longlong llrint_with_overflow_check(double realval)
Definition: item.h:5679
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item.cc:10680
virtual const char * func_name() const =0
A wrapper Item that contains a number of aggregate items, one for each level of rollup (see Item_roll...
Definition: item_sum.h:2715
table_map used_tables() const override
Definition: item_sum.h:2742
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:6364
void update_field() override
Definition: item_sum.h:2757
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2744
Item * get_arg(uint i) override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2779
Item * set_arg(THD *thd, uint i, Item *new_val) override
Definition: item_sum.h:2781
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.cc:6350
void set_current_rollup_level(int level)
Definition: item_sum.h:2791
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:6304
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:6355
bool aggregator_setup(THD *thd) override
Called to initialize the aggregator.
Definition: item_sum.cc:6397
Item_result result_type() const override
Definition: item_sum.h:2743
String * val_str(String *str) override
Definition: item_sum.cc:6329
int set_aggregator(Aggregator::Aggregator_type aggregator) override
Definition: item_sum.cc:6386
Item_sum * unwrap_sum() override
Non-const version.
Definition: item_sum.h:2796
longlong val_int() override
Definition: item_sum.cc:6322
void reset_field() override
Definition: item_sum.h:2756
const Item_sum * unwrap_sum() const override
In case we are an Item_rollup_sum_switcher, return the underlying Item_sum, otherwise,...
Definition: item_sum.h:2795
Item_rollup_sum_switcher(List< Item > *sum_func_per_level)
Definition: item_sum.h:2717
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:6310
bool aggregator_add_all()
Definition: item_sum.h:2768
Item * current_arg() const
Definition: item_sum.cc:6299
Item_sum * master() const
Definition: item_sum.h:2792
Item_sum * child(size_t i) const
Definition: item_sum.h:2800
enum Sumfunctype real_sum_func() const override
Definition: item_sum.h:2753
bool is_rollup_sum_wrapper() const override
Overridden by Item_rollup_sum_switcher.
Definition: item_sum.h:2794
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2752
const char * func_name() const override
Definition: item_sum.h:2741
int m_current_rollup_level
Definition: item_sum.h:2805
double val_real() override
Definition: item_sum.cc:6315
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_sum.cc:6343
uint argument_count() const override
Definition: item_sum.h:2788
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:6336
bool add() override
Definition: item_sum.h:2759
void clear() override
Definition: item_sum.cc:6368
bool reset_and_add_for_rollup(int last_unchanged_group_item_idx)
Definition: item_sum.cc:6374
const int m_num_levels
Definition: item_sum.h:2804
const Item * get_arg(uint i) const override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2780
ROW_NUMBER window function, cf.
Definition: item_sum.h:2266
ulonglong m_ctr
Increment for each row in partition.
Definition: item_sum.h:2268
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2279
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2277
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2293
Item_row_number(const POS &pos, PT_window *w)
Definition: item_sum.h:2271
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4755
Item_result result_type() const override
Definition: item_sum.h:2291
String * val_str(String *) override
Definition: item_sum.cc:4751
longlong val_int() override
Definition: item_sum.cc:4732
void clear() override
Definition: item_sum.cc:4760
const char * func_name() const override
Definition: item_sum.h:2276
double val_real() override
Definition: item_sum.cc:4746
Definition: item_sum.h:1491
enum Type type() const override
Definition: item_sum.h:1494
Item_std_field(Item_sum_std *item)
Definition: item_sum.cc:3797
bool check_function_as_value_generator(uchar *args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_sum.h:1502
enum Item_result result_type() const override
Definition: item_sum.h:1497
double val_real() override
Definition: item_sum.cc:3800
const char * func_name() const override
Definition: item_sum.h:1498
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3808
Definition: item_sum.h:1909
Item_sum_and(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1911
const char * func_name() const override
Definition: item_sum.h:1915
Item_sum_and(THD *thd, Item_sum_and *item)
Definition: item_sum.h:1914
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3265
Definition: item_sum.h:1312
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2216
void clear() override
Definition: item_sum.cc:2271
String * val_str(String *str) override
Definition: item_sum.cc:2386
const char * func_name() const override
Definition: item_sum.h:1342
void update_field() override
calc next value and merge it with field_value.
Definition: item_sum.cc:3494
Item_sum_sum super
Definition: item_sum.h:1316
Item * result_item(Field *) override
Definition: item_sum.h:1339
double val_real() override
Definition: item_sum.cc:2280
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1345
Item_sum_avg(const POS &pos, Item *item_par, bool distinct, PT_window *w)
Definition: item_sum.h:1320
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:2249
my_decimal m_avg_dec
Definition: item_sum.h:1317
uint f_scale
Definition: item_sum.h:1315
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1327
double m_avg
Definition: item_sum.h:1318
longlong val_int() override
Definition: item_sum.h:1334
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2242
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2303
void reset_field() override
Definition: item_sum.cc:3394
uint prec_increment
Definition: item_sum.h:1314
uint dec_bin_size
Definition: item_sum.h:1315
bool add() override
Definition: item_sum.cc:2273
Item_sum_avg(THD *thd, Item_sum_avg *item)
Definition: item_sum.h:1323
uint f_precision
Definition: item_sum.h:1315
This is used in connection with an Item_sum_bit,.
Definition: item_sum.h:1190
double val_real() override
Definition: item_sum.cc:3740
enum Type type() const override
Definition: item_sum.h:1204
ulonglong reset_bits
Definition: item_sum.h:1192
Item_sum_bit_field(Item_result res_type, Item_sum_bit *item, ulonglong reset_bits)
Definition: item_sum.cc:3705
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1201
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3757
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3783
longlong val_int() override
Definition: item_sum.cc:3725
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3790
String * val_str(String *) override
Definition: item_sum.cc:3765
const char * func_name() const override
Definition: item_sum.h:1205
Base class used to implement BIT_AND, BIT_OR and BIT_XOR.
Definition: item_sum.h:1740
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3154
bool add_bits(const String *s1, ulonglong b1)
Accumulate the value of 's1' (if in string mode) or of 'b1' (if in integer mode).
Definition: item_sum.cc:1592
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1849
void remove_bits(const String *s1, ulonglong b1)
For windowing: perform inverse aggregation.
Definition: item_sum.cc:1514
const char initial_value_buff_storage[1]
Buffer used to avoid String allocation in the constructor.
Definition: item_sum.h:1751
static constexpr uint DIGIT_CNT_CARD
Definition: item_sum.h:1794
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1836
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:1458
bool m_is_xor
true iff BIT_XOR
Definition: item_sum.h:1797
void clear() override
Definition: item_sum.cc:3237
Item * result_item(Field *) override
Definition: item_sum.h:1832
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:1433
longlong val_int() override
Definition: item_sum.cc:3212
Item_sum super
Definition: item_sum.h:1741
ulonglong * m_digit_cnt
Execution state (windowing): Used for AND, OR to be able to invert window functions in optimized mode...
Definition: item_sum.h:1786
Item_result hybrid_type
Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT.
Definition: item_sum.h:1749
ulonglong reset_bits
Stores the neutral element for function.
Definition: item_sum.h:1743
Item_sum_bit(const POS &pos, Item *item_par, ulonglong reset_arg, PT_window *w)
Definition: item_sum.h:1800
bool is_and() const
Definition: item_sum.h:1862
void reset_field() override
Definition: item_sum.cc:3422
ulonglong m_count
Execution state (windowing): this is for counting rows entering and leaving the window frame,...
Definition: item_sum.h:1757
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3161
double val_real() override
Definition: item_sum.cc:3186
bool add() override
Common implementation of Item_sum_or::add, Item_sum_and:add and Item_sum_xor::add.
Definition: item_sum.cc:1676
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_sum.cc:3168
enum Item_result result_type() const override
Definition: item_sum.h:1837
uint m_digit_cnt_card
Definition: item_sum.h:1792
Item_sum_bit(THD *thd, Item_sum_bit *item)
Copy constructor, used for executing subqueries with temporary tables.
Definition: item_sum.h:1813
String * val_str(String *str) override
Definition: item_sum.cc:3123
void update_field() override
Definition: item_sum.cc:3432
ulonglong bits
Stores the result value for the INT_RESULT.
Definition: item_sum.h:1745
ulonglong m_frame_null_count
Execution state (windowing): this is for counting NULLs of rows entering and leaving the window frame...
Definition: item_sum.h:1765
String value_buff
Stores the result value for the STRING_RESULT.
Definition: item_sum.h:1747
Implements ST_Collect which aggregates geometries into Multipoints, Multilinestrings,...
Definition: item_sum.h:2810
bool add() override
Definition: item_sum.cc:6472
void clear() override
Definition: item_sum.cc:6466
void read_result_field()
Definition: item_sum.cc:6524
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:6435
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_sum.h:2830
std::optional< gis::srid_t > srid
Definition: item_sum.h:2812
Item_sum_collect(const POS &pos, Item *a, PT_window *w, bool distinct)
Definition: item_sum.h:2821
void update_field() override
Definition: item_sum.cc:6614
longlong val_int() override
Definition: item_sum.h:2828
bool get_time(MYSQL_TIME *) override
Definition: item_sum.h:2831
std::unique_ptr< gis::Geometrycollection > m_geometrycollection
Definition: item_sum.h:2813
String * val_str(String *str) override
Definition: item_sum.cc:6567
void reset_field() override
Definition: item_sum.cc:6677
Item_sum_collect(THD *thd, Item_sum *item)
Definition: item_sum.h:2818
void store_result_field()
Definition: item_sum.cc:6620
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:6672
bool check_wf_semantics1(THD *thd, Query_block *, Window_evaluation_requirements *r) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:6457
const char * func_name() const override
Definition: item_sum.h:2870
void pop_front()
Definition: item_sum.cc:6560
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2832
Item_result result_type() const override
Definition: item_sum.h:2833
int set_aggregator(Aggregator::Aggregator_type) override
Definition: item_sum.h:2834
double val_real() override
Definition: item_sum.h:2829
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6519
Definition: item_sum.h:1062
longlong count
Definition: item_sum.h:1063
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1094
longlong val_int() override
Definition: item_sum.cc:2178
void update_field() override
Definition: item_sum.cc:3485
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2159
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1091
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:2210
void make_const(longlong count_arg)
Definition: item_sum.h:1101
void reset_field() override
Definition: item_sum.cc:3386
Item_sum_count(Item_int *number)
Definition: item_sum.h:1074
Item_sum_count(THD *thd, Item_sum_count *item)
Definition: item_sum.h:1089
Item_sum_count(const POS &pos, PT_item_list *list, PT_window *w)
Constructs an instance for COUNT(DISTINCT)
Definition: item_sum.h:1085
void clear() override
Definition: item_sum.cc:2167
const char * func_name() const override
Definition: item_sum.h:1108
Item_sum_count(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1072
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:1100
bool add() override
Definition: item_sum.cc:2169
This is used in connection which a parent Item_sum:
Definition: item_sum.h:1125
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1147
Item_result hybrid_type
Stores the Item's result type.
Definition: item_sum.h:1130
enum Item_result result_type() const override
Definition: item_sum.h:1133
bool check_function_as_value_generator(uchar *args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_sum.h:1141
Field * field
The tmp table's column containing the value of the set function.
Definition: item_sum.h:1128
bool mark_field_in_map(uchar *arg) override
Mark underlying field in read or write map of a table.
Definition: item_sum.h:1134
Abstract base class for the MIN and MAX aggregate functions.
Definition: item_sum.h:1536
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3076
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:3071
bool setup_hybrid(Item *item, Item *value_arg)
MIN/MAX function setup.
Definition: item_sum.cc:1768
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:1687
virtual Item_sum_hybrid * clone_hybrid(THD *thd) const =0
Create a clone of this object.
bool add() override
Definition: item_sum.cc:3106
const bool m_is_min
Tells if this is the MIN function (true) or the MAX function (false).
Definition: item_sum.h:1543
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3009
bool compute()
This function implements the optimized version of retrieving min/max value.
Definition: item_sum.cc:2811
void min_max_update_int_field()
Definition: item_sum.cc:3616
longlong val_int() override
Definition: item_sum.cc:2944
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:2999
void reset_field() override
Definition: item_sum.cc:3289
void clear() override
Definition: item_sum.cc:2762
int64 m_saved_last_value_at
Execution state: keeps track of at which row we saved a non-null last value.
Definition: item_sum.h:1583
Item_cache * arg_cache
Definition: item_sum.h:1552
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3057
void min_max_update_json_field()
Definition: item_sum.cc:3569
void update_field() override
Definition: item_sum.cc:3530
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_sum.cc:2970
void update_after_wf_arguments_changed(THD *thd) override
Signal to the function that its arguments may have changed, and that any internal caches etc.
Definition: item_sum.cc:2772
bool keep_field_type() const override
Definition: item_sum.h:1676
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2982
int64 m_cnt
Execution state: keeps track if this is the first row in the frame when buffering is not needed.
Definition: item_sum.h:1577
void min_max_update_real_field()
Definition: item_sum.cc:3603
Item_sum_hybrid(THD *thd, const Item_sum_hybrid *item)
Definition: item_sum.h:1647
bool any_value()
Definition: item_sum.h:1684
Item_result hybrid_type
Definition: item_sum.h:1554
bool was_values
Definition: item_sum.h:1555
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_sum.cc:2958
bool m_optimize
Set to true when min/max can be optimized using window's ordering.
Definition: item_sum.h:1563
Item_sum_hybrid(const POS &pos, Item *item_par, bool is_min, PT_window *w)
Definition: item_sum.h:1631
Item_sum_hybrid(Item *item_par, bool is_min)
Definition: item_sum.h:1615
Item_sum super
Definition: item_sum.h:1537
void min_max_update_temporal_field()
Definition: item_sum.cc:3551
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *r) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:2777
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:1737
String * val_str(String *) override
Definition: item_sum.cc:3019
Arg_comparator * cmp
Definition: item_sum.h:1553
void min_max_update_str_field()
Definition: item_sum.cc:3587
enum Item_result result_type() const override
Definition: item_sum.h:1677
void min_max_update_decimal_field()
Definition: item_sum.cc:3634
double val_real() override
Definition: item_sum.cc:2930
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:1785
bool m_want_first
For min() - Set to true when results are ordered in ascending and false when descending.
Definition: item_sum.h:1571
Item_cache * value
Definition: item_sum.h:1552
bool m_nulls_first
Set to true if the window is ordered ascending.
Definition: item_sum.h:1559
void split_sum_func(THD *thd, Ref_item_array ref_item_array, mem_root_deque< Item * > *fields) override
See comments in Item_cmp_func::split_sum_func()
Definition: item_sum.cc:3046
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_sum.h:1678
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:3032
Definition: item_sum.h:980
Item_sum_int(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:982
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1006
Item_sum_int(THD *thd, Item_sum_int *item)
Definition: item_sum.h:992
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1009
double val_real() override
Definition: item_sum.h:1000
Item_sum_int(Item *item_par)
Definition: item_sum.h:996
enum Item_result result_type() const override
Definition: item_sum.h:1010
String * val_str(String *str) override
Definition: item_sum.cc:1400
Item_sum_int(const POS &pos, PT_item_list *list, PT_window *w)
Definition: item_sum.h:987
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:1402
Implements aggregation of values into an array.
Definition: item_sum.h:1256
Item_sum_json_array(THD *thd, Item_sum *item, unique_ptr_destroy_only< Json_wrapper > wrapper, unique_ptr_destroy_only< Json_array > array)
Definition: item_sum.cc:5905
~Item_sum_json_array() override
bool add() override
Definition: item_sum.cc:5978
unique_ptr_destroy_only< Json_array > m_json_array
Accumulates the final value.
Definition: item_sum.h:1258
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6027
const char * func_name() const override
Definition: item_sum.h:1268
void clear() override
Definition: item_sum.cc:5920
Implements aggregation of values into an object.
Definition: item_sum.h:1275
Item_sum_json_object(THD *thd, Item_sum *item, unique_ptr_destroy_only< Json_wrapper > wrapper, unique_ptr_destroy_only< Json_object > object)
Definition: item_sum.cc:5929
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6135
bool add() override
Definition: item_sum.cc:6040
unique_ptr_destroy_only< Json_object > m_json_object
Accumulates the final value.
Definition: item_sum.h:1277
~Item_sum_json_object() override
const char * func_name() const override
Definition: item_sum.h:1304
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5954
std::map< std::string, int > m_key_map
Map of keys in Json_object and the count for each key within a window frame.
Definition: item_sum.h:1286
void clear() override
Definition: item_sum.cc:5944
bool m_optimize
If window provides ordering on the key in Json_object, a key_map is not needed to handle rows leaving...
Definition: item_sum.h:1294
String m_tmp_key_value
Buffer used to get the value of the key.
Definition: item_sum.h:1279
Common abstraction for Item_sum_json_array and Item_sum_json_object.
Definition: item_sum.h:1212
void reset_field() override
Definition: item_sum.cc:5865
void update_field() override
Definition: item_sum.cc:5885
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5783
unique_ptr_destroy_only< Json_wrapper > m_wrapper
Wrapper around the container (object/array) which accumulates the value.
Definition: item_sum.h:1221
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1237
longlong val_int() override
Definition: item_sum.cc:5821
String m_value
String used when reading JSON binary values or JSON text values.
Definition: item_sum.h:1217
String m_conversion_buffer
String used for converting JSON text values to utf8mb4 charset.
Definition: item_sum.h:1219
Item_sum super
Definition: item_sum.h:1213
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5859
Item_sum_json(unique_ptr_destroy_only< Json_wrapper > wrapper, Args &&...parent_args)
Construct an Item_sum_json instance.
Definition: item_sum.cc:5723
~Item_sum_json() override
String * val_str(String *str) override
Definition: item_sum.cc:5763
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5836
Item_result result_type() const override
Definition: item_sum.h:1238
bool fix_fields(THD *thd, Item **pItem) override
Definition: item_sum.cc:5737
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5732
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5853
double val_real() override
Definition: item_sum.cc:5806
Definition: item_sum.h:1721
Item_sum_max(Item *item_par)
Definition: item_sum.h:1723
Item_sum_max(THD *thd, const Item_sum_max *item)
Definition: item_sum.h:1726
const char * func_name() const override
Definition: item_sum.h:1729
Item_sum_max * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3087
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1728
Item_sum_max(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1724
Definition: item_sum.h:1707
Item_sum_min(THD *thd, const Item_sum_min *item)
Definition: item_sum.h:1712
Item_sum_min(Item *item_par)
Definition: item_sum.h:1709
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1714
const char * func_name() const override
Definition: item_sum.h:1715
Item_sum_min(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1710
Item_sum_min * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3083
Common abstract class for: Item_avg_field Item_variance_field.
Definition: item_sum.h:1158
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1164
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.h:1170
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1167
longlong val_int() override
Definition: item_sum.h:1160
Definition: item_sum.h:937
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:1396
Item_sum_num(THD *thd, Item_sum_num *item)
Definition: item_sum.h:956
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:1406
longlong val_int() override
Definition: item_sum.h:965
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_sum.h:958
String * val_str(String *str) override
Definition: item_sum.cc:1394
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:971
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:974
Item_sum super
Definition: item_sum.h:938
Item_sum_num(Item *item_par)
Definition: item_sum.h:962
bool is_evaluated
Definition: item_sum.h:947
Item_sum_num(const POS &pos, Item *item_par, PT_window *window)
Definition: item_sum.h:950
void reset_field() override
Definition: item_sum.cc:3276
Item_sum_num(const POS &pos, PT_item_list *list, PT_window *w)
Definition: item_sum.h:953
Definition: item_sum.h:1899
Item_sum_or(THD *thd, Item_sum_or *item)
Definition: item_sum.h:1904
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3251
const char * func_name() const override
Definition: item_sum.h:1905
Item_sum_or(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1901
Definition: item_sum.h:1514
double val_real() override
Definition: item_sum.cc:2396
Item_sum_std(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1516
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2405
Item_sum_std(THD *thd, Item_sum_std *item)
Definition: item_sum.h:1519
const char * func_name() const override
Definition: item_sum.h:1523
enum Item_result result_type() const override
Definition: item_sum.h:1527
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1520
Item * result_item(Field *) override
Definition: item_sum.h:1522
Definition: item_sum.h:1013
ulonglong m_count
Execution state: this is for counting rows entering and leaving the window frame, see m_frame_null_co...
Definition: item_sum.h:1024
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:1914
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:1849
enum Item_result result_type() const override
Definition: item_sum.h:1052
double sum
Definition: item_sum.h:1016
bool add() override
Definition: item_sum.cc:1936
Item_result hybrid_type
Definition: item_sum.h:1015
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:1868
void reset_field() override
Definition: item_sum.cc:3368
String * val_str(String *str) override
Definition: item_sum.cc:2025
longlong val_int() override
Definition: item_sum.cc:1957
my_decimal dec_buffs[2]
Definition: item_sum.h:1017
void clear() override
Definition: item_sum.cc:1856
const char * func_name() const override
Definition: item_sum.h:1058
Item_sum_sum(const POS &pos, Item *item_par, bool distinct, PT_window *window)
Definition: item_sum.h:1034
void update_field() override
calc next value and merge it with field_value.
Definition: item_sum.cc:3456
uint curr_dec_buff
Definition: item_sum.h:1018
ulonglong m_frame_null_count
Execution state: this is for counting NULLs of rows entering and leaving the window frame,...
Definition: item_sum.h:1031
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2031
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:1870
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1043
double val_real() override
Definition: item_sum.cc:1981
Definition: item_sum.h:2067
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2078
longlong val_int() override
Definition: item_sum.cc:3925
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2081
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3927
Item_sum_udf_decimal(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2069
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3936
double val_real() override
Definition: item_sum.cc:3923
enum Item_result result_type() const override
Definition: item_sum.h:2084
String * val_str(String *) override
Definition: item_sum.cc:3919
Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
Definition: item_sum.h:2072
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2085
Definition: item_sum.h:1977
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1996
longlong val_int() override
Definition: item_sum.h:1983
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3915
String * val_str(String *str) override
Definition: item_sum.cc:3911
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3898
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1990
double val_real() override
Definition: item_sum.cc:3903
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
Definition: item_sum.h:1981
Item_sum_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1979
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1993
Definition: item_sum.h:2004
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2017
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
Definition: item_sum.h:2008
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2022
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2020
enum Item_result result_type() const override
Definition: item_sum.h:2021
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3940
String * val_str(String *str) override
Definition: item_sum.cc:3952
Item_sum_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2006
longlong val_int() override
Definition: item_sum.cc:3944
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3956
double val_real() override
Definition: item_sum.h:2011
Definition: item_sum.h:2029
bool resolve_type(THD *) override
Default max_length is max argument length.
Definition: item_sum.cc:3962
double val_real() override
Definition: item_sum.h:2036
String * val_str(String *) override
Definition: item_sum.cc:3978
enum Item_result result_type() const override
Definition: item_sum.h:2062
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2056
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2059
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3970
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:3974
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
Definition: item_sum.h:2033
longlong val_int() override
Definition: item_sum.h:2045
Item_sum_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2031
Definition: item_sum.h:1436
ulonglong count
Definition: item_sum.h:1447
void update_field() override
Definition: item_sum.cc:2736
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2604
double val_real() override
Definition: item_sum.cc:2681
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1481
void clear() override
Definition: item_sum.cc:2658
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2624
Item * result_item(Field *) override
Definition: item_sum.h:1473
Item_sum_variance(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1457
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1466
double recurrence_s
Definition: item_sum.h:1445
bool optimize
If set, uses a algorithm II mentioned in the class description to calculate the variance which helps ...
Definition: item_sum.h:1455
const char * func_name() const override
Definition: item_sum.h:1475
bool add() override
Definition: item_sum.cc:2660
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:1474
double recurrence_s2
Definition: item_sum.h:1446
Item_result hybrid_type
Definition: item_sum.h:1440
bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:2588
double recurrence_m
Used in recurrence relation.
Definition: item_sum.h:1444
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2711
uint prec_increment
Definition: item_sum.h:1449
enum Item_result result_type() const override
Definition: item_sum.h:1480
void reset_field() override
Definition: item_sum.cc:2716
uint sample
Definition: item_sum.h:1448
Field * create_tmp_field(bool group, TABLE *table) override
Create a new field to match the type of value we're expected to yield.
Definition: item_sum.cc:2637
Definition: item_sum.h:1919
const char * func_name() const override
Definition: item_sum.h:1927
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3258
Item_sum_xor(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1921
Item_sum_xor(THD *thd, Item_sum_xor *item)
Definition: item_sum.h:1926
Class Item_sum is the base class used for special expressions that SQL calls 'set functions'.
Definition: item_sum.h:399
virtual void update_after_wf_arguments_changed(THD *)
Signal to the function that its arguments may have changed, and that any internal caches etc.
Definition: item_sum.h:665
bool collect_grouped_aggregates(uchar *) override
Definition: item_sum.cc:703
table_map not_null_tables() const override
Return table map of tables that can't be NULL tables (tables that are used in a context where if they...
Definition: item_sum.h:587
virtual bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs)
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:404
void split_sum_func(THD *thd, Ref_item_array ref_item_array, mem_root_deque< Item * > *fields) override
See comments in Item_cmp_func::split_sum_func()
Definition: item_sum.cc:888
bool m_null_executed
true if the function is determined to be NULL at start of execution
Definition: item_sum.h:513
virtual bool check_wf_semantics2(Window_evaluation_requirements *reqs)
Like check_wf_semantics1.
Definition: item_sum.h:723
void aggregator_clear()
Called to cleanup the aggregator.
Definition: item_sum.h:677
virtual const Item_sum * unwrap_sum() const
In case we are an Item_rollup_sum_switcher, return the underlying Item_sum, otherwise,...
Definition: item_sum.h:783
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:476
bool aggregate_check_distinct(uchar *arg) override
Definition: item_sum.cc:619
bool init_sum_func_check(THD *thd)
Prepare an aggregate function for checking of context.
Definition: item_sum.cc:156
virtual bool aggregator_setup(THD *thd)
Called to initialize the aggregator.
Definition: item_sum.h:671
bool wf_common_init()
Common initial actions for window functions.
Definition: item_sum.cc:909
Item_sum(const POS &pos, PT_window *w)
Definition: item_sum.h:521
bool force_copy_fields
Used in making ROLLUP.
Definition: item_sum.h:427
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:611
bool allow_group_via_temp_table
If incremental update of fields is supported.
Definition: item_sum.h:494
int8 max_aggr_level
max level of unbound column references
Definition: item_sum.h:491
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:458
void make_const()
Definition: item_sum.h:594
Item * replace_aggregate(uchar *) override
Definition: item_sum.cc:734
Window * window()
Definition: item_sum.h:733
virtual void make_unique()
Definition: item_sum.h:616
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:876
bool reset_and_add()
Resets the aggregate value to its default and aggregates the current value of its attribute(s).
Definition: item_sum.h:551
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.h:592
virtual Item * result_item(Field *field)
Definition: item_sum.h:574
bool forced_const
True means that this field has been evaluated during optimization.
Definition: item_sum.h:508
virtual void update_field()=0
bool check_sum_func(THD *thd, Item **ref)
Validate the semantic requirements of a set function.
Definition: item_sum.cc:241
bool clean_up_after_removal(uchar *arg) override
Remove the item from the list of inner aggregation functions in the Query_block it was moved to by It...
Definition: item_sum.cc:514
void unsupported_as_wf()
Definition: item_sum.h:792
Aggregator * aggr
Aggregator class instance.
Definition: item_sum.h:408
const Window * window() const
Definition: item_sum.h:734
virtual bool needs_partition_cardinality() const
Return true if we need to make two passes over the rows in the partition - either because we need the...
Definition: item_sum.h:763
virtual bool is_rollup_sum_wrapper() const
Overridden by Item_rollup_sum_switcher.
Definition: item_sum.h:777
bool aggregate_check_group(uchar *arg) override
Definition: item_sum.cc:643
bool with_distinct
Indicates how the aggregate function was specified by the parser : true if it was written as AGGREGAT...
Definition: item_sum.h:434
virtual enum Sumfunctype real_sum_func() const
Definition: item_sum.h:545
nesting_map save_deny_window_func
WFs are forbidden when resolving Item_sum; this member is used to restore WF allowance status afterwa...
Definition: item_sum.h:500
bool collect_scalar_subqueries(uchar *) override
Definition: item_sum.cc:742
virtual void reset_field()=0
virtual bool framing() const
All aggregates are framing, i.e.
Definition: item_sum.h:747
bool has_with_distinct() const
Definition: item_sum.h:438
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_sum.cc:762
Item * set_arg(THD *thd, uint i, Item *new_val) override
Definition: item_sum.cc:832
bool m_window_resolved
True if we have already resolved this window functions window reference.
Definition: item_sum.h:418
virtual Field * create_tmp_field(bool group, TABLE *table)
Definition: item_sum.cc:676
friend class Aggregator_simple
Definition: item_sum.h:401
void add_used_tables_for_aggr_func()
Add used_tables information for aggregate function, based on its aggregated query block.
Definition: item_sum.cc:820
Item ** referenced_by[2]
For a group aggregate which is aggregated into an outer query block; none, or just the first or both ...
Definition: item_sum.h:480
bool m_null_resolved
true if the function is resolved to be always NULL
Definition: item_sum.h:511
Sumfunctype
Definition: item_sum.h:440
@ COUNT_FUNC
Definition: item_sum.h:441
@ STD_FUNC
Definition: item_sum.h:449
@ AVG_DISTINCT_FUNC
Definition: item_sum.h:446
@ DENSE_RANK_FUNC
Definition: item_sum.h:457
@ FIRST_LAST_VALUE_FUNC
Definition: item_sum.h:462
@ SUM_BIT_FUNC
Definition: item_sum.h:451
@ COUNT_DISTINCT_FUNC
Definition: item_sum.h:442
@ SUM_FUNC
Definition: item_sum.h:443
@ CUME_DIST_FUNC
Definition: item_sum.h:458
@ SUM_DISTINCT_FUNC
Definition: item_sum.h:444
@ UDF_SUM_FUNC
Definition: item_sum.h:452
@ ROLLUP_SUM_SWITCHER_FUNC
Definition: item_sum.h:464
@ JSON_AGG_FUNC
Definition: item_sum.h:454
@ ROW_NUMBER_FUNC
Definition: item_sum.h:455
@ MAX_FUNC
Definition: item_sum.h:448
@ GEOMETRY_AGGREGATE_FUNC
Definition: item_sum.h:465
@ AVG_FUNC
Definition: item_sum.h:445
@ MIN_FUNC
Definition: item_sum.h:447
@ NTILE_FUNC
Definition: item_sum.h:460
@ NTH_VALUE_FUNC
Definition: item_sum.h:463
@ GROUP_CONCAT_FUNC
Definition: item_sum.h:453
@ RANK_FUNC
Definition: item_sum.h:456
@ LEAD_LAG_FUNC
Definition: item_sum.h:461
@ PERCENT_RANK_FUNC
Definition: item_sum.h:459
@ VARIANCE_FUNC
Definition: item_sum.h:450
virtual int set_aggregator(Aggregator::Aggregator_type aggregator)
Definition: item_sum.cc:837
bool aggregator_add()
Called to add value to the aggregator.
Definition: item_sum.h:683
Item_sum(Item *a)
Definition: item_sum.h:524
void set_distinct(bool distinct)
Definition: item_sum.h:686
Item_sum * next_sum
next in the circular chain of registered objects
Definition: item_sum.h:482
Item_sum * in_sum_func
the containing set function if any
Definition: item_sum.h:483
virtual bool keep_field_type() const
Definition: item_sum.h:572
bool collect_item_field_or_view_ref_processor(uchar *) override
Collects fields and view references that have the qualifying table in the specified query block.
Definition: item_sum.cc:752
bool has_force_copy_fields() const
Definition: item_sum.h:437
Type type() const override
Definition: item_sum.h:541
void mark_as_sum_func()
Definition: item_sum.cc:448
Query_block * aggr_query_block
For a group aggregate, query block where function is aggregated.
Definition: item_sum.h:490
PT_window * m_window
If sum is a window function, this field contains the window.
Definition: item_sum.h:413
Item_sum(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:529
static ulonglong ram_limitation(THD *thd)
Calculate the affordable RAM limit for structures like TREE or Unique used in Item_sum_*.
Definition: item_sum.cc:128
bool reset_wf_state(uchar *arg) override
Reset execution state for such window function types as determined by arg.
Definition: item_sum.cc:896
table_map used_tables() const override
Definition: item_sum.h:584
virtual Item_sum * unwrap_sum()
Non-const version.
Definition: item_sum.h:785
void fix_after_pullout(Query_block *parent_query_block, Query_block *removed_query_block) override
Fix after tables have been moved from one query_block level to the parent level, e....
Definition: item_sum.cc:783
virtual bool setup(THD *)
Definition: item_sum.h:701
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:864
int8 max_sum_func_level
max level of aggregation for contained functions
Definition: item_sum.h:493
virtual bool uses_only_one_row() const
Only for framing window functions.
Definition: item_sum.h:753
Item ** get_arg_ptr(uint i)
Definition: item_sum.h:651
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_sum.cc:96
virtual enum Sumfunctype sum_func() const =0
Item_sum(const POS &pos, Item *a, Item *b, PT_window *w)
Definition: item_sum.h:532
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_sum.cc:592
bool has_aggregate_ref_in_group_by(uchar *arg) override
Check if an aggregate is referenced from within the GROUP BY clause of the query block in which it is...
Definition: item_sum.cc:668
Query_block * base_query_block
query block where function is placed
Definition: item_sum.h:484
Definition: item_sum.h:1935
udf_handler udf
Definition: item_sum.h:1939
void update_field() override
Definition: item_sum.h:1971
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3878
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_sum.cc:3856
void reset_field() override
Definition: item_sum.h:1970
bool add() override
Definition: item_sum.cc:3871
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.h:1956
Item_udf_sum(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1942
void clear() override
Definition: item_sum.cc:3865
~Item_udf_sum() override
Definition: item_sum.h:1950
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:3887
Item_udf_sum(THD *thd, Item_udf_sum *item)
Definition: item_sum.h:1946
Item_sum super
Definition: item_sum.h:1936
const char * func_name() const override
Definition: item_sum.h:1955
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1966
Definition: item_sum.h:1354
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_sum.h:1363
const char * func_name() const override
Definition: item_sum.h:1367
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1366
enum Type type() const override
Definition: item_sum.h:1360
Item_variance_field(Item_sum_variance *item)
Definition: item_sum.cc:3827
uint sample
Definition: item_sum.h:1356
String * val_str(String *str) override
Definition: item_sum.h:1362
double val_real() override
Definition: item_sum.cc:3841
bool check_function_as_value_generator(uchar *args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_sum.h:1371
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
virtual double val_real()=0
String str_value
str_values's main purpose is to cache the value in save_in_field
Definition: item.h:3367
void set_nullable(bool nullable)
Definition: item.h:3472
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3374
bool get_time_from_decimal(MYSQL_TIME *ltime)
Convert val_decimal() to time in MYSQL_TIME.
Definition: item.cc:1559
void set_data_type(enum_field_types data_type)
Set the data type of the current Item.
Definition: item.h:1394
my_decimal * val_decimal_from_string(my_decimal *decimal_value)
Definition: item.cc:343
bool is_nullable() const
Definition: item.h:3471
void set_data_type_geometry()
Set the data type of the Item to be GEOMETRY.
Definition: item.h:1594
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1540
bool get_time_from_real(MYSQL_TIME *ltime)
Convert val_real() to time in MYSQL_TIME.
Definition: item.cc:1550
bool get_date_from_decimal(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_decimal() to date in MYSQL_TIME.
Definition: item.cc:1472
void set_data_type_double()
Set the data type of the Item to be double precision floating point.
Definition: item.h:1438
Item_name_string item_name
Name from query.
Definition: item.h:3375
bool fixed
True if item has been resolved.
Definition: item.h:3460
virtual Item_result result_type() const
Definition: item.h:1332
bool null_value
True if item is null.
Definition: item.h:3497
Type
Definition: item.h:889
@ SUM_FUNC_ITEM
Definition: item.h:893
@ FIELD_VARIANCE_ITEM
Definition: item.h:906
@ FIELD_AVG_ITEM
Definition: item.h:900
@ FIELD_STD_ITEM
Definition: item.h:905
@ FIELD_BIT_ITEM
Definition: item.h:918
bool get_date_from_numeric(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a numeric type to date.
Definition: item.cc:1500
virtual TYPELIB * get_typelib() const
Get the typelib information for an item of type set or enum.
Definition: item.h:1657
my_decimal * val_decimal_from_real(my_decimal *decimal_value)
Definition: item.cc:328
bool unsigned_flag
Definition: item.h:3498
longlong val_int_from_string()
Definition: item.cc:500
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1453
void set_grouping_func()
Set the property: this item is a call to GROUPING.
Definition: item.h:3292
bool get_time_from_numeric(MYSQL_TIME *ltime)
Convert a numeric type to time.
Definition: item.cc:1592
virtual bool mark_field_in_map(uchar *arg)
Mark underlying field in read or write map of a table.
Definition: item.h:2657
bool hidden
If the item is in a SELECT list (Query_block::fields) and hidden is true, the item wasn't actually in...
Definition: item.h:3508
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1481
void set_data_type_from_item(const Item *item)
Set data type properties of the item from the properties of another item.
Definition: item.h:1634
bool get_date_from_real(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_real() to date in MYSQL_TIME.
Definition: item.cc:1463
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1416
double val_real_from_string()
Definition: item.cc:446
bool update_null_value()
Make sure the null_value member has a correct value.
Definition: item.cc:7418
String * val_string_from_real(String *str)
Definition: item.cc:261
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1568
Represents a JSON array container, i.e.
Definition: json_dom.h:520
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:373
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1161
Definition: sql_list.h:434
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:105
Definition: parse_tree_nodes.h:214
Parse tree node for a window; just a shallow wrapper for class Window, q.v.
Definition: parse_tree_window.h:39
void error(Context *pc, const POS &pos) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:206
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1156
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
const CHARSET_INFO * charset() const
Definition: sql_string.h:241
const char * ptr() const
Definition: sql_string.h:250
size_t length() const
Definition: sql_string.h:242
void set(String &str, size_t offset, size_t arg_length)
Definition: sql_string.h:281
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Object containing parameters used when creating and using temporary tables.
Definition: temp_table_param.h:95
Unique – class for unique (removing of duplicates).
Definition: uniques.h:53
Represents the (explicit) window of a SQL 2003 section 7.11 <window clause>, or the implicit (inlined...
Definition: window.h:105
uint size() const
Definition: sql_list.h:272
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:110
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:94
const char * name() const
Definition: sql_udf.h:117
bool is_initialized() const
Definition: sql_udf.h:115
bool m_original
Definition: sql_udf.h:104
bool fix_fields(THD *thd, Item_result_field *item, uint arg_count, Item **args)
Definition: item_func.cc:4474
void free_handler()
Definition: item_func.cc:4455
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:53
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:62
@ MYSQL_TYPE_NEWDECIMAL
Definition: field_types.h:78
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:59
static const std::string dec("DECRYPTION")
This file declares the coordinate system specific subclasses of the geometry class hierarchy.
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:216
static uint16 key1[1001]
Definition: hp_test2.cc:47
int dump_leaf_key(void *key_arg, element_count count, void *item_arg)
Append data from current leaf to item->result.
Definition: item_sum.cc:4092
int group_concat_key_cmp_with_distinct(const void *arg, const void *key1, const void *key2)
Compares the values for fields in expr list of GROUP_CONCAT.
Definition: item_sum.cc:4014
int group_concat_key_cmp_with_order(const void *arg, const void *key1, const void *key2)
function of sort for syntax: GROUP_CONCAT(expr,... ORDER BY col,... )
Definition: item_sum.cc:4049
A better implementation of the UNIX ctype(3) library.
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:511
#define my_strntod(s, a, b, c, d)
Definition: m_ctype.h:779
longlong my_strtoll10(const char *nptr, const char **endptr, int *error)
Definition: my_strtoll10.cc:87
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:489
Header for compiler-dependent features.
It is interface module to fixed precision decimals library.
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
int64_t int64
Definition: my_inttypes.h:68
long long int longlong
Definition: my_inttypes.h:55
int8_t int8
Definition: my_inttypes.h:62
#define MYF(v)
Definition: my_inttypes.h:97
uint32_t uint32
Definition: my_inttypes.h:67
Common header for many mysys elements.
uint64_t nesting_map
Definition: my_table_map.h:31
uint64_t table_map
Definition: my_table_map.h:30
Interface for low level time utilities.
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:94
uint32 element_count
Definition: my_tree.h:52
static int count
Definition: myisam_ftdump.cc:43
Time declarations shared between the server and client API: you should not add anything to this heade...
thread_local MEM_ROOT ** THR_MALLOC
Definition: mysqld.cc:1560
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
Definition: commit_order_queue.h:34
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
static int destroy(mysql_cond_t *that, const char *, unsigned int)
Definition: mysql_cond_v1_native.cc:54
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2879
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:86
File containing constants that can be used throughout the server.
constexpr const size_t STRING_BUFFER_USUAL_SIZE
Definition: sql_const.h:124
Our own string classes, used pervasively throughout the executor.
Definition: m_ctype.h:385
Struct used to pass around arguments to/from check_function_as_value_generator.
Definition: item.h:488
int err_code
the error code found during check(if any)
Definition: item.h:495
const char * banned_function_name
the name of the function which is not allowed
Definition: item.h:502
int get_unnamed_function_error_code() const
Return the correct error code, based on whether or not if we are checking for disallowed functions in...
Definition: item.h:507
argument used by walk method collect_grouped_aggregates ("cga")
Definition: item_sum.h:620
Collect_grouped_aggregate_info(Query_block *select)
Definition: item_sum.h:633
Query_block * m_query_block
The query block we walk from.
Definition: item_sum.h:628
std::vector< Item_sum * > list
accumulated all aggregates found
Definition: item_sum.h:622
std::set< Item_sum * > aggregates_that_were_hidden
Definition: item_sum.h:623
bool m_break_off
true: break off transformation
Definition: item_sum.h:630
bool m_outside
true: an aggregate aggregates outside m_query_block
Definition: item_sum.h:632
Definition: mysql_time.h:82
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:121
Collects evaluation requirements from a window function, used by Item_sum::check_wf_semantics and its...
Definition: window.h:1538
Bison "location" class.
Definition: parse_location.h:43
unsigned int uint
Definition: uca9-dump.cc:75
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
@ STRING_RESULT
not valid for UDFs
Definition: udf_registration_types.h:41
@ DECIMAL_RESULT
not valid for UDFs
Definition: udf_registration_types.h:45
@ REAL_RESULT
char *
Definition: udf_registration_types.h:42
@ INT_RESULT
double
Definition: udf_registration_types.h:43
@ INVALID_RESULT
Definition: udf_registration_types.h:40
enum_null_treatment
Cf.
Definition: window_lex.h:58
This file declares the interface of the WKB parser for geometries and the parser for the internal geo...