1#ifndef ITEM_SUM_INCLUDED
2#define ITEM_SUM_INCLUDED
54#include "mysqld_error.h"
578 if (item ==
nullptr)
return nullptr;
602 bool eq(
const Item *item)
const override;
797 snprintf(buff,
sizeof(buff),
"%s as window function",
func_name());
914 void clear()
override;
916 void endup()
override;
1009 return static_cast<double>(
val_int());
1053 void clear()
override;
1054 bool add()
override;
1074 void clear()
override;
1075 bool add()
override;
1150 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1229 template <
typename... Args>
1231 Args &&... parent_args);
1267 const char *
func_name()
const override {
return "json_arrayagg"; }
1268 void clear()
override;
1269 bool add()
override;
1303 const char *
func_name()
const override {
return "json_objectagg"; }
1304 void clear()
override;
1305 bool add()
override;
1329 void clear()
override;
1330 bool add()
override;
1368 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1462 void clear()
override;
1463 bool add()
override;
1471 return sample ?
"var_samp" :
"variance";
1495 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1515 return sample ?
"stddev_samp" :
"std";
1653 void clear()
override;
1679 bool add()
override;
1829 void clear()
override;
1851 bool add()
override;
1906 const char *
func_name()
const override {
return "bit_and"; }
1918 const char *
func_name()
const override {
return "bit_xor"; }
1953 if (
udf.
fix_fields(thd,
this, this->arg_count, this->args))
return true;
1959 void clear()
override;
1960 bool add()
override;
2029 const char *end_not_used;
2033 &end_not_used, &err_not_used)
2044 return cs->cset->strtoll10(
cs, res->
ptr(), &
end, &err_not_used);
2160 const char *
func_name()
const override {
return "group_concat"; }
2163 void clear()
override;
2164 bool add()
override;
2175 const char *end_ptr = res->
ptr() + res->
length();
2203 context = pointer_cast<Item_ident::Change_context *>(arg)->m_context;
2267 const char *
func_name()
const override {
return "row_number"; }
2280 void clear()
override;
2315 return m_dense ?
"dense_rank" :
"rank";
2338 void clear()
override;
2351 const char *
func_name()
const override {
return "cume_dist"; }
2392 const char *
func_name()
const override {
return "percent_rank"; }
2404 void clear()
override;
2495 void clear()
override;
2564 return m_is_first ?
"first_value" :
"last_value";
2572 void clear()
override;
2633 const char *
func_name()
const override {
return "nth_value"; }
2640 void clear()
override;
2691 const char *
func_name()
const override {
return "grouping"; }
2714 :
Item_sum((*sum_func_per_level)[0]),
2716 args = (*THR_MALLOC)->ArrayAlloc<
Item *>(sum_func_per_level->
size());
2718 for (
Item &item : *sum_func_per_level) {
2737 const char *
func_name()
const override {
return "rollup_sum_switcher"; }
2754 void clear()
override;
2778 Item *ret =
nullptr;
2797 return down_cast<Item_sum *>(
args[i]);
2835 if (
aggr !=
nullptr) {
2841 return aggr ? false :
true;
2859 bool add()
override;
2864 void clear()
override;
2865 const char *
func_name()
const override {
return "st_collect"; }
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
The distinct aggregator.
Definition: item_sum.h:816
uint tree_key_length
Definition: item_sum.h:869
uint32 * field_lengths
Definition: item_sum.h:846
bool arg_is_null(bool use_null_value) override
NULLness of being-aggregated argument.
Definition: item_sum.cc:2199
bool endup_done
Definition: item_sum.h:827
Const_distinct
Definition: item_sum.h:871
@ CONST_NULL
Set to true if the result is known to be always NULL.
Definition: item_sum.h:882
@ CONST_NOT_NULL
Set to true if count distinct is on only const items.
Definition: item_sum.h:889
@ NOT_CONST
Definition: item_sum.h:872
static int composite_key_cmp(const void *arg, const void *a, const void *b)
Correctly compare composite keys.
Definition: item_sum.cc:987
void endup() override
Calculate the aggregate function value.
Definition: item_sum.cc:1373
~Aggregator_distinct() override
Definition: item_sum.cc:2149
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:900
double arg_val_real() override
Floating point value of being-aggregated argument.
Definition: item_sum.cc:2194
void clear() override
Invalidate calculated value and clear the distinct rows.
Definition: item_sum.cc:1267
bool setup(THD *) override
Called before feeding the first row.
Definition: item_sum.cc:1058
bool unique_walk_function(void *element)
Aggregate a distinct row from the distinct hash table.
Definition: item_sum.cc:2142
Unique * tree
Definition: item_sum.h:861
Temp_table_param * tmp_table_param
Definition: item_sum.h:852
bool add() override
Process incoming row.
Definition: item_sum.cc:1299
TABLE * table
Definition: item_sum.h:838
Aggregator_type Aggrtype() override
Definition: item_sum.h:911
my_decimal * arg_val_decimal(my_decimal *value) override
Decimal value of being-aggregated argument.
Definition: item_sum.cc:2189
enum Aggregator_distinct::Const_distinct const_distinct
Aggregator_distinct(Item_sum *sum)
Definition: item_sum.h:903
The pass-through aggregator.
Definition: item_sum.h:930
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:936
Aggregator_simple(Item_sum *sum)
Definition: item_sum.h:932
bool setup(THD *thd) override
Called before adding the first row.
Definition: item_sum.h:935
Aggregator_type Aggrtype() override
Definition: item_sum.h:933
my_decimal * arg_val_decimal(my_decimal *value) override
Decimal value of being-aggregated argument.
Definition: item_sum.cc:2166
void endup() override
Called when there are no more data and the final value is to be retrieved.
Definition: item_sum.h:938
double arg_val_real() override
Floating point value of being-aggregated argument.
Definition: item_sum.cc:2170
bool add() override
Called when there's a new value to be aggregated.
Definition: item_sum.h:937
bool arg_is_null(bool use_null_value) override
NULLness of being-aggregated argument.
Definition: item_sum.cc:2174
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:205
Definition: item_sum.h:1180
uint prec_increment
Definition: item_sum.h:1183
uint f_precision
Definition: item_sum.h:1182
uint dec_bin_size
Definition: item_sum.h:1182
uint f_scale
Definition: item_sum.h:1182
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3740
String * val_str(String *) override
Definition: item_sum.cc:3755
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1189
enum Type type() const override
Definition: item_sum.h:1185
double val_real() override
Definition: item_sum.cc:3725
Item_avg_field(Item_result res_type, Item_sum_avg *item)
Definition: item_sum.cc:3706
CUME_DIST window function, cf.
Definition: item_sum.h:2345
Item_cume_dist(const POS &pos, PT_window *w)
Definition: item_sum.h:2349
Item_non_framing_wf super
Definition: item_sum.h:2346
double val_real() override
Definition: item_sum.cc:4936
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2352
void clear() override
Definition: item_sum.h:2363
const char * func_name() const override
Definition: item_sum.h:2351
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:2362
String * val_str(String *) override
Definition: item_sum.cc:4956
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:4926
longlong val_int() override
Definition: item_sum.cc:4948
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2354
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:4960
Item_result result_type() const override
Definition: item_sum.h:2368
FIRST_VALUE/LAST_VALUE window functions, cf.
Definition: item_sum.h:2545
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2567
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5164
void reset_field() override
Definition: item_sum.h:2586
const char * func_name() const override
Definition: item_sum.h:2563
bool setup_first_last()
Definition: item_sum.cc:5206
double val_real() override
Definition: item_sum.cc:5255
String * val_str(String *str) override
Definition: item_sum.cc:5310
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:5223
bool 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:5194
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:5150
bool compute()
Core logic of FIRST/LAST_VALUE window functions.
Definition: item_sum.cc:5227
int64 cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2550
Item_result m_hybrid_type
Definition: item_sum.h:2548
enum Item_result result_type() const override
Definition: item_sum.h:2575
Item_cache * m_value
Definition: item_sum.h:2549
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5286
void update_field() override
Definition: item_sum.h:2587
enum_null_treatment m_null_treatment
Definition: item_sum.h:2547
Item_sum super
Definition: item_sum.h:2551
void clear() override
Definition: item_sum.cc:5217
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2595
bool add() override
Definition: item_sum.h:2588
Item_first_last_value(const POS &pos, bool first, Item *a, enum_null_treatment null_treatment, PT_window *w)
Definition: item_sum.h:2554
bool m_is_first
if true, the function is FIRST_VALUE, else LAST_VALUE
Definition: item_sum.h:2546
longlong val_int() override
Definition: item_sum.cc:5245
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5296
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5276
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5175
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5265
Definition: item_sum.h:2091
void clear() override
Definition: item_sum.cc:4403
bool m_result_finalized
True if result has been written to output buffer.
Definition: item_sum.h:2130
String result
Definition: item_sum.h:2106
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:2135
longlong val_int() override
Definition: item_sum.h:2171
const String * get_separator_str() const noexcept
Definition: item_sum.h:2189
uint32_t get_group_concat_max_len() const noexcept
Definition: item_sum.h:2190
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_sum.h:2178
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:4149
uint row_count
Definition: item_sum.h:2121
void make_unique() override
Definition: item_sum.cc:4690
bool change_context_processor(uchar *arg) override
Definition: item_sum.h:2202
bool setup(THD *thd) override
Definition: item_sum.cc:4559
Item_sum super
Definition: item_sum.h:2092
bool distinct
True if GROUP CONCAT has the DISTINCT attribute.
Definition: item_sum.h:2095
TABLE * table
Temporary table used to perform group concat.
Definition: item_sum.h:2119
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:4070
double val_real() override
Definition: item_sum.cc:4698
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2159
String * val_str(String *str) override
Definition: item_sum.cc:4705
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:4106
bool force_copy_fields
Definition: item_sum.h:2128
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:4466
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2181
Unique * unique_filter
If DISTINCT is used with this GROUP_CONCAT, this member is used to filter out duplicates.
Definition: item_sum.h:2117
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2207
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:4401
Mem_root_array< ORDER > order_array
Definition: item_sum.h:2120
TREE tree_base
Definition: item_sum.h:2107
void update_field() override
Definition: item_sum.h:2166
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:4730
Temp_table_param * tmp_table_param
Describes the temporary table used to perform group concat.
Definition: item_sum.h:2105
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:4328
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:4393
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:4276
const char * func_name() const override
Definition: item_sum.h:2160
Item_result result_type() const override
Definition: item_sum.h:2161
Field * make_string_field(TABLE *table_arg) const override
Create a field to hold a string value from an item.
Definition: item_sum.cc:4360
uint m_order_arg_count
The number of ORDER BY items.
Definition: item_sum.h:2097
TREE * tree
Definition: item_sum.h:2108
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:4238
bool has_distinct() const noexcept
Definition: item_sum.h:2188
bool add() override
Definition: item_sum.cc:4415
Name_resolution_context * context
Resolver context, points to containing query block.
Definition: item_sum.h:2101
void reset_field() override
Definition: item_sum.h:2165
uint m_field_arg_count
The number of selected items, aka the concat field list.
Definition: item_sum.h:2099
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:2126
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2184
bool warning_for_row
Definition: item_sum.h:2127
String * separator
String containing separator between group items.
Definition: item_sum.h:2103
~Item_func_group_concat() override
Definition: item_sum.h:2152
const Mem_root_array< ORDER > & get_order_array() const noexcept
Definition: item_sum.h:2193
Class for implementation of the GROUPING function.
Definition: item_sum.h:2686
const Query_block * m_query_block
The query block in which this function is called.
Definition: item_sum.h:2701
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:6371
longlong val_int() override
Evaluation of the GROUPING function.
Definition: item_sum.cc:6320
Item_func_grouping(const POS &pos, PT_item_list *a)
Definition: item_sum.h:2688
const char * func_name() const override
Definition: item_sum.h:2691
bool fix_fields(THD *thd, Item **ref) override
Resolve the fields in the GROUPING function.
Definition: item_sum.cc:6265
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:6341
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_sum.cc:6383
enum Functype functype() const override
Definition: item_sum.h:2692
Definition: item_func.h:100
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
virtual Item * get_arg(uint i)
Get the i'th argument of the function that this object represents.
Definition: item_func.h:492
Functype
Definition: item_func.h:209
@ GROUPING_FUNC
Definition: item_func.h:263
virtual uint argument_count() const
Definition: item_func.h:131
table_map used_tables_cache
Value used in calculation of result of used_tables()
Definition: item_func.h:193
virtual const char * func_name() const =0
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:528
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:504
Item ** arguments() const
Definition: item_func.h:132
virtual void fix_num_length_and_dec()
Definition: item_func.cc:861
const char * original_db_name() const
Definition: item.h:4262
void set_original_field_name(const char *name_arg)
Definition: item.h:4259
const char * original_table_name() const
Definition: item.h:4263
Definition: item_func.h:1019
LEAD/LAG window functions, cf.
Definition: item_sum.h:2452
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5583
bool has_value() const
Definition: item_sum.h:2526
bool m_is_lead
if true, the function is LEAD, else LAG
Definition: item_sum.h:2454
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:2510
const char * func_name() const override
Definition: item_sum.h:2486
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5731
bool 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:5643
void set_use_default(bool value)
Definition: item_sum.h:2528
String * val_str(String *str) override
Definition: item_sum.cc:5723
bool m_use_default
execution state: use default value for current row
Definition: item_sum.h:2469
enum Item_result result_type() const override
Definition: item_sum.h:2499
Item_cache * m_default
Definition: item_sum.h:2458
bool compute()
Core logic of LEAD/LAG window functions.
Definition: item_sum.cc:5758
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:2473
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:5670
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2489
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5740
enum_null_treatment m_null_treatment
Definition: item_sum.h:2453
void clear() override
Definition: item_sum.cc:5682
bool use_default() const
Definition: item_sum.h:2529
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_sum.cc:5592
bool m_has_value
Execution state: if set, we already have a value for current row.
Definition: item_sum.h:2468
longlong val_int() override
Definition: item_sum.cc:5694
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5710
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5615
Item_result m_hybrid_type
Definition: item_sum.h:2456
int64 m_n
canonicalized offset value
Definition: item_sum.h:2455
double val_real() override
Definition: item_sum.cc:5702
void set_has_value(bool value)
Definition: item_sum.h:2525
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5533
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5748
bool setup_lead_lag()
Definition: item_sum.cc:5654
Item_cache * m_value
Definition: item_sum.h:2457
Item_non_framing_wf super
Definition: item_sum.h:2470
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:5689
Common parent class for window functions that always work on the entire partition,...
Definition: item_sum.h:2223
Item_non_framing_wf(const POS &pos, PT_window *w)
Definition: item_sum.h:2227
bool add() override
Definition: item_sum.h:2244
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2238
Item_non_framing_wf(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2228
Item_non_framing_wf(const POS &pos, PT_item_list *opt_list, PT_window *w)
Definition: item_sum.h:2230
Item_sum super
Definition: item_sum.h:2224
Item_non_framing_wf(THD *thd, Item_non_framing_wf *i)
Definition: item_sum.h:2232
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2234
void update_field() override
Definition: item_sum.h:2243
void reset_field() override
Definition: item_sum.h:2242
bool framing() const override
All aggregates are framing, i.e.
Definition: item_sum.h:2251
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:4766
NTH_VALUE window function, cf.
Definition: item_sum.h:2611
int64 m_cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2618
void update_field() override
Definition: item_sum.h:2658
bool compute()
Core logic of NTH_VALUE window functions.
Definition: item_sum.cc:5426
String * val_str(String *str) override
Definition: item_sum.cc:5493
Item_sum super
Definition: item_sum.h:2620
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5040
enum Item_result result_type() const override
Definition: item_sum.h:2646
Item_result m_hybrid_type
Definition: item_sum.h:2615
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5479
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5513
bool setup_nth()
Definition: item_sum.cc:5385
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5334
enum_field_types m_hybrid_field_type
Definition: item_sum.h:2616
int64 m_n
The N of the function.
Definition: item_sum.h:2613
double val_real() override
Definition: item_sum.cc:5469
bool m_from_last
true iff FROM_LAST was specified
Definition: item_sum.h:2614
Item_cache * m_value
Definition: item_sum.h:2617
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5523
enum_null_treatment m_null_treatment
Definition: item_sum.h:2612
void reset_field() override
Definition: item_sum.h:2657
longlong val_int() override
Definition: item_sum.cc:5459
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:2623
void clear() override
Definition: item_sum.cc:5396
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5320
bool 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:5374
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2634
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:5402
bool add() override
Definition: item_sum.h:2659
const char * func_name() const override
Definition: item_sum.h:2633
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5503
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:5406
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2666
NTILE window function, cf.
Definition: item_sum.h:2415
void clear() override
Definition: item_sum.h:2445
Item_non_framing_wf super
Definition: item_sum.h:2416
String * val_str(String *) override
Definition: item_sum.cc:5119
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2428
const char * func_name() const override
Definition: item_sum.h:2425
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:2446
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5134
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5058
double val_real() override
Definition: item_sum.cc:5114
longlong val_int() override
Definition: item_sum.cc:5064
longlong m_value
Definition: item_sum.h:2417
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:5121
Item_ntile(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2420
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2426
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:5126
Item_result result_type() const override
Definition: item_sum.h:2444
PERCENT_RANK window function, cf.
Definition: item_sum.h:2374
String * val_str(String *) override
Definition: item_sum.cc:5023
Item_percent_rank(const POS &pos, PT_window *w)
Definition: item_sum.h:2385
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2377
const char * func_name() const override
Definition: item_sum.h:2392
Item_result result_type() const override
Definition: item_sum.h:2409
~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:4965
ulonglong m_peers
Needed to make PERCENT_RANK same for peers.
Definition: item_sum.h:2378
double val_real() override
Definition: item_sum.cc:4989
Item_non_framing_wf super
Definition: item_sum.h:2375
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2395
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2393
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:2402
bool m_last_peer_visited
Set when the last peer has been visited.
Definition: item_sum.h:2382
void clear() override
Definition: item_sum.cc:5032
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:5027
longlong val_int() override
Definition: item_sum.cc:5015
RANK or DENSE_RANK window function, cf.
Definition: item_sum.h:2294
Item_result result_type() const override
Definition: item_sum.h:2339
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:4821
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:4845
ulonglong m_duplicates
Needed to make RANK different from DENSE_RANK.
Definition: item_sum.h:2299
bool m_dense
If true, the object represents DENSE_RANK.
Definition: item_sum.h:2296
longlong val_int() override
Definition: item_sum.cc:4863
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2318
~Item_rank() override
Definition: item_sum.cc:4919
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2322
Item_rank(const POS &pos, bool dense, PT_window *w)
Definition: item_sum.h:2303
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4898
const char * func_name() const override
Definition: item_sum.h:2314
double val_real() override
Definition: item_sum.cc:4891
String * val_str(String *) override
Definition: item_sum.cc:4896
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2298
void clear() override
Clear state for a new partition.
Definition: item_sum.cc:4903
Mem_root_array< Cached_item * > m_previous
Values of previous row's ORDER BY items.
Definition: item_sum.h:2301
Item_non_framing_wf super
Definition: item_sum.h:2295
Item with result field.
Definition: item.h:5832
longlong llrint_with_overflow_check(double realval)
Definition: item.h:5871
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item.cc:10910
A wrapper Item that contains a number of aggregate items, one for each level of rollup (see Item_roll...
Definition: item_sum.h:2711
table_map used_tables() const override
Definition: item_sum.h:2738
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:6459
void update_field() override
Definition: item_sum.h:2753
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2740
Item * get_arg(uint i) override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2775
Item * set_arg(THD *thd, uint i, Item *new_val) override
Definition: item_sum.h:2777
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.cc:6445
void set_current_rollup_level(int level)
Definition: item_sum.h:2787
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:6399
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:6450
bool aggregator_setup(THD *thd) override
Called to initialize the aggregator.
Definition: item_sum.cc:6492
Item_result result_type() const override
Definition: item_sum.h:2739
String * val_str(String *str) override
Definition: item_sum.cc:6424
int set_aggregator(Aggregator::Aggregator_type aggregator) override
Definition: item_sum.cc:6481
Item_sum * unwrap_sum() override
Non-const version.
Definition: item_sum.h:2792
longlong val_int() override
Definition: item_sum.cc:6417
void reset_field() override
Definition: item_sum.h:2752
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:2791
Item_rollup_sum_switcher(List< Item > *sum_func_per_level)
Definition: item_sum.h:2713
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:6405
bool aggregator_add_all()
Definition: item_sum.h:2764
Item * current_arg() const
Definition: item_sum.cc:6394
Item_sum * master() const
Definition: item_sum.h:2788
Item_sum * child(size_t i) const
Definition: item_sum.h:2796
enum Sumfunctype real_sum_func() const override
Definition: item_sum.h:2749
bool is_rollup_sum_wrapper() const override
Overridden by Item_rollup_sum_switcher.
Definition: item_sum.h:2790
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2748
const char * func_name() const override
Definition: item_sum.h:2737
int m_current_rollup_level
Definition: item_sum.h:2801
double val_real() override
Definition: item_sum.cc:6410
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_sum.cc:6438
uint argument_count() const override
Definition: item_sum.h:2784
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:6431
bool add() override
Definition: item_sum.h:2755
void clear() override
Definition: item_sum.cc:6463
bool reset_and_add_for_rollup(int last_unchanged_group_item_idx)
Definition: item_sum.cc:6469
const int m_num_levels
Definition: item_sum.h:2800
const Item * get_arg(uint i) const override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2776
ROW_NUMBER window function, cf.
Definition: item_sum.h:2257
ulonglong m_ctr
Increment for each row in partition.
Definition: item_sum.h:2259
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2270
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2268
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2284
Item_row_number(const POS &pos, PT_window *w)
Definition: item_sum.h:2262
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4814
Item_result result_type() const override
Definition: item_sum.h:2282
String * val_str(String *) override
Definition: item_sum.cc:4810
longlong val_int() override
Definition: item_sum.cc:4791
void clear() override
Definition: item_sum.cc:4819
const char * func_name() const override
Definition: item_sum.h:2267
double val_real() override
Definition: item_sum.cc:4805
Definition: item_sum.h:1486
enum Type type() const override
Definition: item_sum.h:1489
Item_std_field(Item_sum_std *item)
Definition: item_sum.cc:3853
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:1493
enum Item_result result_type() const override
Definition: item_sum.h:1492
double val_real() override
Definition: item_sum.cc:3856
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3864
Definition: item_sum.h:1900
Item_sum_and(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1902
const char * func_name() const override
Definition: item_sum.h:1906
Item_sum_and(THD *thd, Item_sum_and *item)
Definition: item_sum.h:1905
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3321
Definition: item_sum.h:1311
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2267
void clear() override
Definition: item_sum.cc:2323
String * val_str(String *str) override
Definition: item_sum.cc:2438
const char * func_name() const override
Definition: item_sum.h:1341
void update_field() override
calc next value and merge it with field_value.
Definition: item_sum.cc:3550
Item_sum_sum super
Definition: item_sum.h:1315
Item * result_item(Field *) override
Definition: item_sum.h:1338
double val_real() override
Definition: item_sum.cc:2332
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1344
Item_sum_avg(const POS &pos, Item *item_par, bool distinct, PT_window *w)
Definition: item_sum.h:1319
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:2301
my_decimal m_avg_dec
Definition: item_sum.h:1316
uint f_scale
Definition: item_sum.h:1314
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1326
double m_avg
Definition: item_sum.h:1317
longlong val_int() override
Definition: item_sum.h:1333
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2294
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2355
void reset_field() override
Definition: item_sum.cc:3450
uint prec_increment
Definition: item_sum.h:1313
uint dec_bin_size
Definition: item_sum.h:1314
bool add() override
Definition: item_sum.cc:2325
Item_sum_avg(THD *thd, Item_sum_avg *item)
Definition: item_sum.h:1322
uint f_precision
Definition: item_sum.h:1314
This is used in connection with an Item_sum_bit,.
Definition: item_sum.h:1193
double val_real() override
Definition: item_sum.cc:3796
enum Type type() const override
Definition: item_sum.h:1207
ulonglong reset_bits
Definition: item_sum.h:1195
Item_sum_bit_field(Item_result res_type, Item_sum_bit *item, ulonglong reset_bits)
Definition: item_sum.cc:3761
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1204
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3813
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3839
longlong val_int() override
Definition: item_sum.cc:3781
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3846
String * val_str(String *) override
Definition: item_sum.cc:3821
Base class used to implement BIT_AND, BIT_OR and BIT_XOR.
Definition: item_sum.h:1731
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3210
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:1637
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1840
void remove_bits(const String *s1, ulonglong b1)
For windowing: perform inverse aggregation.
Definition: item_sum.cc:1559
const char initial_value_buff_storage[1]
Buffer used to avoid String allocation in the constructor.
Definition: item_sum.h:1742
static constexpr uint DIGIT_CNT_CARD
Definition: item_sum.h:1785
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1827
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:1501
bool m_is_xor
true iff BIT_XOR
Definition: item_sum.h:1788
void clear() override
Definition: item_sum.cc:3293
Item * result_item(Field *) override
Definition: item_sum.h:1823
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:1476
longlong val_int() override
Definition: item_sum.cc:3268
Item_sum super
Definition: item_sum.h:1732
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:1777
Item_result hybrid_type
Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT.
Definition: item_sum.h:1740
ulonglong reset_bits
Stores the neutral element for function.
Definition: item_sum.h:1734
Item_sum_bit(const POS &pos, Item *item_par, ulonglong reset_arg, PT_window *w)
Definition: item_sum.h:1791
bool is_and() const
Definition: item_sum.h:1853
void reset_field() override
Definition: item_sum.cc:3478
ulonglong m_count
Execution state (windowing): this is for counting rows entering and leaving the window frame,...
Definition: item_sum.h:1748
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3217
double val_real() override
Definition: item_sum.cc:3242
bool add() override
Common implementation of Item_sum_or::add, Item_sum_and:add and Item_sum_xor::add.
Definition: item_sum.cc:1721
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_sum.cc:3224
enum Item_result result_type() const override
Definition: item_sum.h:1828
uint m_digit_cnt_card
Definition: item_sum.h:1783
Item_sum_bit(THD *thd, Item_sum_bit *item)
Copy constructor, used for executing subqueries with temporary tables.
Definition: item_sum.h:1804
String * val_str(String *str) override
Definition: item_sum.cc:3179
void update_field() override
Definition: item_sum.cc:3488
ulonglong bits
Stores the result value for the INT_RESULT.
Definition: item_sum.h:1736
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:1756
String value_buff
Stores the result value for the STRING_RESULT.
Definition: item_sum.h:1738
Implements ST_Collect which aggregates geometries into Multipoints, Multilinestrings,...
Definition: item_sum.h:2806
bool add() override
Definition: item_sum.cc:6567
void clear() override
Definition: item_sum.cc:6561
void read_result_field()
Definition: item_sum.cc:6622
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:6530
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_sum.h:2826
std::optional< gis::srid_t > srid
Definition: item_sum.h:2808
Item_sum_collect(const POS &pos, Item *a, PT_window *w, bool distinct)
Definition: item_sum.h:2817
void update_field() override
Definition: item_sum.cc:6715
longlong val_int() override
Definition: item_sum.h:2824
bool get_time(MYSQL_TIME *) override
Definition: item_sum.h:2827
std::unique_ptr< gis::Geometrycollection > m_geometrycollection
Definition: item_sum.h:2809
String * val_str(String *str) override
Definition: item_sum.cc:6668
void reset_field() override
Definition: item_sum.cc:6778
Item_sum_collect(THD *thd, Item_sum *item)
Definition: item_sum.h:2814
void store_result_field()
Definition: item_sum.cc:6721
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:6773
bool check_wf_semantics1(THD *thd, Query_block *, Window_evaluation_requirements *r) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:6552
const char * func_name() const override
Definition: item_sum.h:2865
void pop_front()
Definition: item_sum.cc:6661
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2828
Item_result result_type() const override
Definition: item_sum.h:2829
int set_aggregator(Aggregator::Aggregator_type) override
Definition: item_sum.h:2830
double val_real() override
Definition: item_sum.h:2825
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6617
Definition: item_sum.h:1069
longlong count
Definition: item_sum.h:1070
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1101
longlong val_int() override
Definition: item_sum.cc:2229
void update_field() override
Definition: item_sum.cc:3541
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2210
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1098
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:2261
void make_const(longlong count_arg)
Definition: item_sum.h:1108
void reset_field() override
Definition: item_sum.cc:3442
Item_sum_count(Item_int *number)
Definition: item_sum.h:1081
Item_sum_count(THD *thd, Item_sum_count *item)
Definition: item_sum.h:1096
Item_sum_count(const POS &pos, PT_item_list *list, PT_window *w)
Constructs an instance for COUNT(DISTINCT)
Definition: item_sum.h:1092
void clear() override
Definition: item_sum.cc:2218
const char * func_name() const override
Definition: item_sum.h:1115
Item_sum_count(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1079
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:1107
bool add() override
Definition: item_sum.cc:2220
This is used in connection which a parent Item_sum:
Definition: item_sum.h:1132
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1154
Item_result hybrid_type
Stores the Item's result type.
Definition: item_sum.h:1137
enum Item_result result_type() const override
Definition: item_sum.h:1140
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:1148
Field * field
The tmp table's column containing the value of the set function.
Definition: item_sum.h:1135
bool mark_field_in_map(uchar *arg) override
Mark underlying field in read or write map of a table.
Definition: item_sum.h:1141
Abstract base class for the MIN and MAX aggregate functions.
Definition: item_sum.h:1527
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3132
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:3127
bool setup_hybrid(Item *item, Item *value_arg)
MIN/MAX function setup.
Definition: item_sum.cc:1813
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:1678
virtual Item_sum_hybrid * clone_hybrid(THD *thd) const =0
Create a clone of this object.
bool add() override
Definition: item_sum.cc:3162
const bool m_is_min
Tells if this is the MIN function (true) or the MAX function (false).
Definition: item_sum.h:1534
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3061
bool compute()
This function implements the optimized version of retrieving min/max value.
Definition: item_sum.cc:2863
bool has_values()
Definition: item_sum.h:1675
void min_max_update_int_field()
Definition: item_sum.cc:3672
longlong val_int() override
Definition: item_sum.cc:2996
bool m_has_values
Definition: item_sum.h:1546
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3051
void reset_field() override
Definition: item_sum.cc:3345
bool 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:3098
void clear() override
Definition: item_sum.cc:2814
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:1574
Item_cache * arg_cache
Definition: item_sum.h:1543
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3113
void min_max_update_json_field()
Definition: item_sum.cc:3625
void update_field() override
Definition: item_sum.cc:3586
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_sum.cc:3022
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:2824
bool keep_field_type() const override
Definition: item_sum.h:1667
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3034
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:1568
void min_max_update_real_field()
Definition: item_sum.cc:3659
Item_sum_hybrid(THD *thd, const Item_sum_hybrid *item)
Definition: item_sum.h:1638
Item_result hybrid_type
Definition: item_sum.h:1545
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_sum.cc:3010
bool m_optimize
Set to true when min/max can be optimized using window's ordering.
Definition: item_sum.h:1554
Item_sum_hybrid(const POS &pos, Item *item_par, bool is_min, PT_window *w)
Definition: item_sum.h:1622
Item_sum_hybrid(Item *item_par, bool is_min)
Definition: item_sum.h:1606
Item_sum super
Definition: item_sum.h:1528
void min_max_update_temporal_field()
Definition: item_sum.cc:3607
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:2829
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:1782
String * val_str(String *) override
Definition: item_sum.cc:3071
Arg_comparator * cmp
Definition: item_sum.h:1544
void min_max_update_str_field()
Definition: item_sum.cc:3643
enum Item_result result_type() const override
Definition: item_sum.h:1668
void min_max_update_decimal_field()
Definition: item_sum.cc:3690
double val_real() override
Definition: item_sum.cc:2982
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:1830
bool m_want_first
For min() - Set to true when results are ordered in ascending and false when descending.
Definition: item_sum.h:1562
Item_cache * value
Definition: item_sum.h:1543
bool m_nulls_first
Set to true if the window is ordered ascending.
Definition: item_sum.h:1550
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_sum.h:1669
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:3084
Definition: item_sum.h:987
Item_sum_int(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:989
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1013
Item_sum_int(THD *thd, Item_sum_int *item)
Definition: item_sum.h:999
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1016
double val_real() override
Definition: item_sum.h:1007
Item_sum_int(Item *item_par)
Definition: item_sum.h:1003
enum Item_result result_type() const override
Definition: item_sum.h:1017
String * val_str(String *str) override
Definition: item_sum.cc:1443
Item_sum_int(const POS &pos, PT_item_list *list, PT_window *w)
Definition: item_sum.h:994
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:1445
Implements aggregation of values into an array.
Definition: item_sum.h:1255
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:6001
~Item_sum_json_array() override
bool add() override
Definition: item_sum.cc:6074
unique_ptr_destroy_only< Json_array > m_json_array
Accumulates the final value.
Definition: item_sum.h:1257
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6123
const char * func_name() const override
Definition: item_sum.h:1267
void clear() override
Definition: item_sum.cc:6016
Implements aggregation of values into an object.
Definition: item_sum.h:1274
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:6025
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6231
bool add() override
Definition: item_sum.cc:6136
unique_ptr_destroy_only< Json_object > m_json_object
Accumulates the final value.
Definition: item_sum.h:1276
~Item_sum_json_object() override
const char * func_name() const override
Definition: item_sum.h:1303
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:6050
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:1285
void clear() override
Definition: item_sum.cc:6040
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:1293
String m_tmp_key_value
Buffer used to get the value of the key.
Definition: item_sum.h:1278
Common abstraction for Item_sum_json_array and Item_sum_json_object.
Definition: item_sum.h:1211
void reset_field() override
Definition: item_sum.cc:5961
void update_field() override
Definition: item_sum.cc:5981
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5875
unique_ptr_destroy_only< Json_wrapper > m_wrapper
Wrapper around the container (object/array) which accumulates the value.
Definition: item_sum.h:1220
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1236
longlong val_int() override
Definition: item_sum.cc:5913
String m_value
String used when reading JSON binary values or JSON text values.
Definition: item_sum.h:1216
String m_conversion_buffer
String used for converting JSON text values to utf8mb4 charset.
Definition: item_sum.h:1218
Item_sum super
Definition: item_sum.h:1212
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5954
~Item_sum_json() override
String * val_str(String *str) override
Definition: item_sum.cc:5856
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5928
Item_result result_type() const override
Definition: item_sum.h:1237
bool fix_fields(THD *thd, Item **pItem) override
Definition: item_sum.cc:5830
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5825
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5946
Item_sum_json(unique_ptr_destroy_only< Json_wrapper > wrapper, Args &&... parent_args)
Construct an Item_sum_json instance.
Definition: item_sum.cc:5816
double val_real() override
Definition: item_sum.cc:5898
Definition: item_sum.h:1712
Item_sum_max(Item *item_par)
Definition: item_sum.h:1714
Item_sum_max(THD *thd, const Item_sum_max *item)
Definition: item_sum.h:1717
const char * func_name() const override
Definition: item_sum.h:1720
Item_sum_max * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3143
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1719
Item_sum_max(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1715
Definition: item_sum.h:1698
Item_sum_min(THD *thd, const Item_sum_min *item)
Definition: item_sum.h:1703
Item_sum_min(Item *item_par)
Definition: item_sum.h:1700
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1705
const char * func_name() const override
Definition: item_sum.h:1706
Item_sum_min(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1701
Item_sum_min * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3139
Common abstract class for: Item_avg_field Item_variance_field.
Definition: item_sum.h:1165
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1171
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.h:1177
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1174
longlong val_int() override
Definition: item_sum.h:1167
Definition: item_sum.h:944
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:1439
Item_sum_num(THD *thd, Item_sum_num *item)
Definition: item_sum.h:963
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:1449
longlong val_int() override
Definition: item_sum.h:972
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_sum.h:965
String * val_str(String *str) override
Definition: item_sum.cc:1437
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:978
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:981
Item_sum super
Definition: item_sum.h:945
Item_sum_num(Item *item_par)
Definition: item_sum.h:969
bool is_evaluated
Definition: item_sum.h:954
Item_sum_num(const POS &pos, Item *item_par, PT_window *window)
Definition: item_sum.h:957
void reset_field() override
Definition: item_sum.cc:3332
Item_sum_num(const POS &pos, PT_item_list *list, PT_window *w)
Definition: item_sum.h:960
Definition: item_sum.h:1890
Item_sum_or(THD *thd, Item_sum_or *item)
Definition: item_sum.h:1895
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3307
const char * func_name() const override
Definition: item_sum.h:1896
Item_sum_or(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1892
Definition: item_sum.h:1505
double val_real() override
Definition: item_sum.cc:2448
Item_sum_std(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1507
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2457
Item_sum_std(THD *thd, Item_sum_std *item)
Definition: item_sum.h:1510
const char * func_name() const override
Definition: item_sum.h:1514
enum Item_result result_type() const override
Definition: item_sum.h:1518
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1511
Item * result_item(Field *) override
Definition: item_sum.h:1513
Definition: item_sum.h:1020
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:1031
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:1965
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:1894
enum Item_result result_type() const override
Definition: item_sum.h:1059
double sum
Definition: item_sum.h:1023
bool add() override
Definition: item_sum.cc:1987
Item_result hybrid_type
Definition: item_sum.h:1022
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:1913
void reset_field() override
Definition: item_sum.cc:3424
String * val_str(String *str) override
Definition: item_sum.cc:2076
longlong val_int() override
Definition: item_sum.cc:2008
my_decimal dec_buffs[2]
Definition: item_sum.h:1024
void clear() override
Definition: item_sum.cc:1901
const char * func_name() const override
Definition: item_sum.h:1065
Item_sum_sum(const POS &pos, Item *item_par, bool distinct, PT_window *window)
Definition: item_sum.h:1041
void update_field() override
calc next value and merge it with field_value.
Definition: item_sum.cc:3512
uint curr_dec_buff
Definition: item_sum.h:1025
ulonglong m_frame_null_count
Execution state: this is for counting NULLs of rows entering and leaving the window frame,...
Definition: item_sum.h:1038
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2082
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:1915
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1050
double val_real() override
Definition: item_sum.cc:2032
Definition: item_sum.h:2058
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2069
longlong val_int() override
Definition: item_sum.cc:3981
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2072
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3983
Item_sum_udf_decimal(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2060
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3992
double val_real() override
Definition: item_sum.cc:3979
enum Item_result result_type() const override
Definition: item_sum.h:2075
String * val_str(String *) override
Definition: item_sum.cc:3975
Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
Definition: item_sum.h:2063
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2076
Definition: item_sum.h:1968
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1987
longlong val_int() override
Definition: item_sum.h:1974
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3971
String * val_str(String *str) override
Definition: item_sum.cc:3967
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3954
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1981
double val_real() override
Definition: item_sum.cc:3959
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
Definition: item_sum.h:1972
Item_sum_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1970
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1984
Definition: item_sum.h:1995
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2008
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
Definition: item_sum.h:1999
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2013
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2011
enum Item_result result_type() const override
Definition: item_sum.h:2012
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3996
String * val_str(String *str) override
Definition: item_sum.cc:4008
Item_sum_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1997
longlong val_int() override
Definition: item_sum.cc:4000
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:4012
double val_real() override
Definition: item_sum.h:2002
Definition: item_sum.h:2020
bool resolve_type(THD *) override
Default max_length is max argument length.
Definition: item_sum.cc:4018
double val_real() override
Definition: item_sum.h:2027
String * val_str(String *) override
Definition: item_sum.cc:4034
enum Item_result result_type() const override
Definition: item_sum.h:2053
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2047
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2050
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:4026
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:4030
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
Definition: item_sum.h:2024
longlong val_int() override
Definition: item_sum.h:2036
Item_sum_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2022
Definition: item_sum.h:1431
ulonglong count
Definition: item_sum.h:1442
void update_field() override
Definition: item_sum.cc:2788
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2656
double val_real() override
Definition: item_sum.cc:2733
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1476
void clear() override
Definition: item_sum.cc:2710
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2676
Item * result_item(Field *) override
Definition: item_sum.h:1468
Item_sum_variance(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1452
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1461
double recurrence_s
Definition: item_sum.h:1440
bool optimize
If set, uses a algorithm II mentioned in the class description to calculate the variance which helps ...
Definition: item_sum.h:1450
const char * func_name() const override
Definition: item_sum.h:1470
bool add() override
Definition: item_sum.cc:2712
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:1469
double recurrence_s2
Definition: item_sum.h:1441
Item_result hybrid_type
Definition: item_sum.h:1435
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:2640
double recurrence_m
Used in recurrence relation.
Definition: item_sum.h:1439
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2763
uint prec_increment
Definition: item_sum.h:1444
enum Item_result result_type() const override
Definition: item_sum.h:1475
void reset_field() override
Definition: item_sum.cc:2768
uint sample
Definition: item_sum.h:1443
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:2689
Definition: item_sum.h:1910
const char * func_name() const override
Definition: item_sum.h:1918
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3314
Item_sum_xor(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1912
Item_sum_xor(THD *thd, Item_sum_xor *item)
Definition: item_sum.h:1917
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:668
bool collect_grouped_aggregates(uchar *) override
Definition: item_sum.cc:725
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:589
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:413
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:726
void aggregator_clear()
Called to cleanup the aggregator.
Definition: item_sum.h:680
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:786
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:485
bool aggregate_check_distinct(uchar *arg) override
Definition: item_sum.cc:641
~Item_sum() override
Definition: item_sum.h:540
bool init_sum_func_check(THD *thd)
Prepare an aggregate function for checking of context.
Definition: item_sum.cc:165
virtual bool aggregator_setup(THD *thd)
Called to initialize the aggregator.
Definition: item_sum.h:674
bool wf_common_init()
Common initial actions for window functions.
Definition: item_sum.cc:937
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:614
bool allow_group_via_temp_table
If incremental update of fields is supported.
Definition: item_sum.h:494
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_sum.h:801
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:467
void make_const()
Definition: item_sum.h:596
Item * replace_aggregate(uchar *) override
Definition: item_sum.cc:756
Window * window()
Definition: item_sum.h:736
virtual void make_unique()
Definition: item_sum.h:619
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_sum.cc:633
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:104
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:901
bool reset_and_add()
Resets the aggregate value to its default and aggregates the current value of its attribute(s).
Definition: item_sum.h:553
bool 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:913
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.h:594
virtual Item * result_item(Field *field)
Definition: item_sum.h:576
bool forced_const
True means that this field has been evaluated during optimization.
Definition: item_sum.h:508
virtual void update_field()=0
bool eq(const Item *item) const override
Definition: item_sum.cc:610
bool check_sum_func(THD *thd, Item **ref)
Validate the semantic requirements of a set function.
Definition: item_sum.cc:250
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:529
void unsupported_as_wf()
Definition: item_sum.h:795
Aggregator * aggr
Aggregator class instance.
Definition: item_sum.h:408
const Window * window() const
Definition: item_sum.h:737
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:766
virtual bool is_rollup_sum_wrapper() const
Overridden by Item_rollup_sum_switcher.
Definition: item_sum.h:780
bool aggregate_check_group(uchar *arg) override
Definition: item_sum.cc:665
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:547
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:764
virtual void reset_field()=0
virtual bool framing() const
All aggregates are framing, i.e.
Definition: item_sum.h:750
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:784
Item * set_arg(THD *thd, uint i, Item *new_val) override
Definition: item_sum.cc:854
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:698
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:842
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:859
bool aggregator_add()
Called to add value to the aggregator.
Definition: item_sum.h:686
Item_sum(Item *a)
Definition: item_sum.h:524
void set_distinct(bool distinct)
Definition: item_sum.h:689
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:574
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:774
bool has_force_copy_fields() const
Definition: item_sum.h:437
Type type() const override
Definition: item_sum.h:543
void mark_as_sum_func()
Definition: item_sum.cc:457
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:137
bool reset_wf_state(uchar *arg) override
Reset execution state for such window function types as determined by arg.
Definition: item_sum.cc:924
table_map used_tables() const override
Definition: item_sum.h:586
virtual Item_sum * unwrap_sum()
Non-const version.
Definition: item_sum.h:788
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:805
virtual bool setup(THD *)
Definition: item_sum.h:704
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:889
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:756
Item ** get_arg_ptr(uint i)
Definition: item_sum.h:654
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 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:690
Query_block * base_query_block
query block where function is placed
Definition: item_sum.h:484
Definition: item_sum.h:1926
udf_handler udf
Definition: item_sum.h:1930
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:3912
void update_field() override
Definition: item_sum.h:1962
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3934
void reset_field() override
Definition: item_sum.h:1961
bool add() override
Definition: item_sum.cc:3927
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.h:1947
Item_udf_sum(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1933
void clear() override
Definition: item_sum.cc:3921
~Item_udf_sum() override
Definition: item_sum.h:1941
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:3943
Item_udf_sum(THD *thd, Item_udf_sum *item)
Definition: item_sum.h:1937
Item_sum super
Definition: item_sum.h:1927
const char * func_name() const override
Definition: item_sum.h:1946
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1957
Definition: item_sum.h:1353
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_sum.h:1362
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1365
enum Type type() const override
Definition: item_sum.h:1359
Item_variance_field(Item_sum_variance *item)
Definition: item_sum.cc:3883
uint sample
Definition: item_sum.h:1355
String * val_str(String *str) override
Definition: item_sum.h:1361
double val_real() override
Definition: item_sum.cc:3897
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:1366
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
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:3561
void set_nullable(bool nullable)
Definition: item.h:3670
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3568
bool get_time_from_decimal(MYSQL_TIME *ltime)
Convert val_decimal() to time in MYSQL_TIME.
Definition: item.cc:1758
void set_data_type(enum_field_types data_type)
Set the data type of the current Item.
Definition: item.h:1513
my_decimal * val_decimal_from_string(my_decimal *decimal_value)
Definition: item.cc:365
bool is_nullable() const
Definition: item.h:3669
void set_data_type_geometry()
Set the data type of the Item to be GEOMETRY.
Definition: item.h:1752
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1739
bool get_time_from_real(MYSQL_TIME *ltime)
Convert val_real() to time in MYSQL_TIME.
Definition: item.cc:1749
bool get_date_from_decimal(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_decimal() to date in MYSQL_TIME.
Definition: item.cc:1671
void set_data_type_double()
Set the data type of the Item to be double precision floating point.
Definition: item.h:1579
Item_name_string item_name
Name from query.
Definition: item.h:3569
bool fixed
True if item has been resolved.
Definition: item.h:3658
virtual Item_result result_type() const
Definition: item.h:1451
bool null_value
True if item is null.
Definition: item.h:3695
Type
Definition: item.h:965
@ SUM_FUNC_ITEM
A grouped aggregate function, or window function.
Definition: item.h:969
@ AGGR_FIELD_ITEM
A special field for certain aggregate operations.
Definition: item.h:970
bool get_date_from_numeric(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a numeric type to date.
Definition: item.cc:1699
virtual TYPELIB * get_typelib() const
Get the typelib information for an item of type set or enum.
Definition: item.h:1819
my_decimal * val_decimal_from_real(my_decimal *decimal_value)
Definition: item.cc:350
bool unsigned_flag
Definition: item.h:3696
longlong val_int_from_string()
Definition: item.cc:522
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1652
void set_grouping_func()
Set the property: this item is a call to GROUPING.
Definition: item.h:3477
bool get_time_from_numeric(MYSQL_TIME *ltime)
Convert a numeric type to time.
Definition: item.cc:1791
virtual bool mark_field_in_map(uchar *arg)
Mark underlying field in read or write map of a table.
Definition: item.h:2824
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:3706
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1680
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:1796
bool get_date_from_real(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_real() to date in MYSQL_TIME.
Definition: item.cc:1662
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1555
double val_real_from_string()
Definition: item.cc:468
bool update_null_value()
Make sure the null_value member has a correct value.
Definition: item.cc:7634
String * val_string_from_real(String *str)
Definition: item.cc:283
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1767
Represents a JSON array container, i.e.
Definition: json_dom.h:516
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
bool add_alias(const std::string &key, Json_dom *value)
Insert the value into the object.
Definition: json_dom.h:411
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1153
Definition: sql_list.h:467
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:233
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:344
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1175
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
const CHARSET_INFO * charset() const
Definition: sql_string.h:240
const char * ptr() const
Definition: sql_string.h:249
size_t length() const
Definition: sql_string.h:241
void set(String &str, size_t offset, size_t arg_length)
Definition: sql_string.h:302
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Object containing parameters used when creating and using temporary tables.
Definition: temp_table_param.h:97
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:110
uint size() const
Definition: sql_list.h:305
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:95
const char * name() const
Definition: sql_udf.h:118
bool is_initialized() const
Definition: sql_udf.h:116
bool m_original
Definition: sql_udf.h:105
bool fix_fields(THD *thd, Item_result_field *item, uint arg_count, Item **args)
Definition: item_func.cc:4619
void free_handler()
Definition: item_func.cc:4600
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:64
@ MYSQL_TYPE_NEWDECIMAL
Definition: field_types.h:81
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:61
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:50
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:4149
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:4070
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:4106
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:500
double my_strntod(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: m_ctype.h:759
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:477
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
MYSQL_STRINGS_EXPORT long long my_strtoll10(const char *nptr, const char **endptr, int *error)
Definition: my_strtoll10.cc:87
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:45
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:1559
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: commit_order_queue.h:34
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
size_t size(const char *const c)
Definition: base64.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
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:125
Our own string classes, used pervasively throughout the executor.
Definition: m_ctype.h:421
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
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:623
Collect_grouped_aggregate_info(Query_block *select)
Definition: item_sum.h:636
Query_block * m_query_block
The query block we walk from.
Definition: item_sum.h:631
std::vector< Item_sum * > list
accumulated all aggregates found
Definition: item_sum.h:625
std::set< Item_sum * > aggregates_that_were_hidden
Definition: item_sum.h:626
bool m_break_off
true: break off transformation
Definition: item_sum.h:633
bool m_outside
true: an aggregate aggregates outside m_query_block
Definition: item_sum.h:635
Definition: mysql_time.h:82
Bison "location" class.
Definition: parse_location.h:43
Instances of Name_resolution_context store the information necessary for name resolution of Items and...
Definition: item.h:415
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:420
Collects evaluation requirements from a window function, used by Item_sum::check_wf_semantics and its...
Definition: window.h:1556
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...