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;
1157 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1233 template <
typename... Args>
1235 Args &&...parent_args);
1271 const char *
func_name()
const override {
return "json_arrayagg"; }
1272 void clear()
override;
1273 bool add()
override;
1307 const char *
func_name()
const override {
return "json_objectagg"; }
1308 void clear()
override;
1309 bool add()
override;
1333 void clear()
override;
1334 bool add()
override;
1366 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1463 void clear()
override;
1464 bool add()
override;
1474 return sample ?
"var_samp" :
"variance";
1498 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1518 return sample ?
"stddev_samp" :
"std";
1656 void clear()
override;
1682 bool add()
override;
1832 void clear()
override;
1854 bool add()
override;
1909 const char *
func_name()
const override {
return "bit_and"; }
1921 const char *
func_name()
const override {
return "bit_xor"; }
1956 if (
udf.
fix_fields(thd,
this, this->arg_count, this->args))
return true;
1962 void clear()
override;
1963 bool add()
override;
2032 const char *end_not_used;
2036 &end_not_used, &err_not_used)
2047 return cs->cset->strtoll10(
cs, res->
ptr(), &
end, &err_not_used);
2163 const char *
func_name()
const override {
return "group_concat"; }
2166 void clear()
override;
2167 bool add()
override;
2178 const char *end_ptr = res->
ptr() + res->
length();
2206 context = pointer_cast<Item_ident::Change_context *>(arg)->m_context;
2270 const char *
func_name()
const override {
return "row_number"; }
2283 void clear()
override;
2318 return m_dense ?
"dense_rank" :
"rank";
2341 void clear()
override;
2354 const char *
func_name()
const override {
return "cume_dist"; }
2395 const char *
func_name()
const override {
return "percent_rank"; }
2407 void clear()
override;
2498 void clear()
override;
2567 return m_is_first ?
"first_value" :
"last_value";
2575 void clear()
override;
2636 const char *
func_name()
const override {
return "nth_value"; }
2643 void clear()
override;
2694 const char *
func_name()
const override {
return "grouping"; }
2717 :
Item_sum((*sum_func_per_level)[0]),
2719 args = (*THR_MALLOC)->ArrayAlloc<
Item *>(sum_func_per_level->
size());
2721 for (
Item &item : *sum_func_per_level) {
2740 const char *
func_name()
const override {
return "rollup_sum_switcher"; }
2757 void clear()
override;
2781 Item *ret =
nullptr;
2800 return down_cast<Item_sum *>(
args[i]);
2838 if (
aggr !=
nullptr) {
2844 return aggr ? false :
true;
2862 bool add()
override;
2867 void clear()
override;
2868 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:2196
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:2146
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:2191
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:2139
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:2186
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:2163
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:2167
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:2171
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:1183
Item_aggr_avg_field(Item_sum_avg *item)
Definition: item_sum.cc:3710
String * val_str(String *) override
Definition: item_sum.cc:3752
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3738
uint m_prec_increment
Definition: item_sum.h:1195
uint m_dec_bin_size
Definition: item_sum.h:1194
double val_real() override
Definition: item_sum.cc:3727
enum Type type() const override
Definition: item_sum.h:1186
uint m_scale
Definition: item_sum.h:1193
uint m_precision
Definition: item_sum.h:1192
This is used in connection with an Item_sum_bit,.
Definition: item_sum.h:1199
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3842
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3835
enum Type type() const override
Definition: item_sum.h:1208
ulonglong m_reset_bits
Definition: item_sum.h:1211
longlong val_int() override
Definition: item_sum.cc:3774
double val_real() override
Definition: item_sum.cc:3789
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3806
String * val_str(String *) override
Definition: item_sum.cc:3814
Item_aggr_bit_field(Item_sum_bit *item, ulonglong reset_bits)
Definition: item_sum.cc:3757
Common abstract class for aggregate field classes that return numeric values: Item_aggr_avg_field Ite...
Definition: item_sum.h:1168
longlong val_int() override
Definition: item_sum.h:1170
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1174
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1177
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.h:1180
Definition: item_sum.h:1489
enum Type type() const override
Definition: item_sum.h:1492
enum Item_result result_type() const override
Definition: item_sum.h:1495
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:1496
double val_real() override
Definition: item_sum.cc:3852
Item_aggr_std_field(Item_sum_std *item)
Definition: item_sum.cc:3849
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3858
Definition: item_sum.h:1355
double val_real() override
Definition: item_sum.cc:3890
Item_aggr_variance_field(Item_sum_variance *item)
Definition: item_sum.cc:3878
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:1364
String * val_str(String *str) override
Definition: item_sum.h:1360
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_sum.h:1361
uint m_sample
Definition: item_sum.h:1372
enum Type type() const override
Definition: item_sum.h:1358
This is used in connection with a parent aggregate Item:
Definition: item_sum.h:1137
bool mark_field_in_map(uchar *arg) override
Mark underlying field in read or write map of a table.
Definition: item_sum.h:1148
Item_result m_result_type
Stores the Item's result type.
Definition: item_sum.h:1142
Field * m_field
The tmp table's column containing the value of the set function.
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:1155
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1147
enum Item_result result_type() const override
Definition: item_sum.h:1145
CUME_DIST window function, cf.
Definition: item_sum.h:2348
Item_cume_dist(const POS &pos, PT_window *w)
Definition: item_sum.h:2352
Item_non_framing_wf super
Definition: item_sum.h:2349
double val_real() override
Definition: item_sum.cc:4930
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2355
void clear() override
Definition: item_sum.h:2366
const char * func_name() const override
Definition: item_sum.h:2354
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:2365
String * val_str(String *) override
Definition: item_sum.cc:4950
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:4920
longlong val_int() override
Definition: item_sum.cc:4942
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2357
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:4954
Item_result result_type() const override
Definition: item_sum.h:2371
FIRST_VALUE/LAST_VALUE window functions, cf.
Definition: item_sum.h:2548
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2570
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5158
void reset_field() override
Definition: item_sum.h:2589
const char * func_name() const override
Definition: item_sum.h:2566
bool setup_first_last()
Definition: item_sum.cc:5200
double val_real() override
Definition: item_sum.cc:5249
String * val_str(String *str) override
Definition: item_sum.cc:5304
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:5217
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:5188
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:5144
bool compute()
Core logic of FIRST/LAST_VALUE window functions.
Definition: item_sum.cc:5221
int64 cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2553
Item_result m_hybrid_type
Definition: item_sum.h:2551
enum Item_result result_type() const override
Definition: item_sum.h:2578
Item_cache * m_value
Definition: item_sum.h:2552
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5280
void update_field() override
Definition: item_sum.h:2590
enum_null_treatment m_null_treatment
Definition: item_sum.h:2550
Item_sum super
Definition: item_sum.h:2554
void clear() override
Definition: item_sum.cc:5211
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2598
bool add() override
Definition: item_sum.h:2591
Item_first_last_value(const POS &pos, bool first, Item *a, enum_null_treatment null_treatment, PT_window *w)
Definition: item_sum.h:2557
bool m_is_first
if true, the function is FIRST_VALUE, else LAST_VALUE
Definition: item_sum.h:2549
longlong val_int() override
Definition: item_sum.cc:5239
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5290
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5270
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5169
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5259
Definition: item_sum.h:2094
void clear() override
Definition: item_sum.cc:4397
bool m_result_finalized
True if result has been written to output buffer.
Definition: item_sum.h:2133
String result
Definition: item_sum.h:2109
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:2138
longlong val_int() override
Definition: item_sum.h:2174
const String * get_separator_str() const noexcept
Definition: item_sum.h:2192
uint32_t get_group_concat_max_len() const noexcept
Definition: item_sum.h:2193
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_sum.h:2181
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:4143
uint row_count
Definition: item_sum.h:2124
void make_unique() override
Definition: item_sum.cc:4684
bool change_context_processor(uchar *arg) override
Definition: item_sum.h:2205
bool setup(THD *thd) override
Definition: item_sum.cc:4553
Item_sum super
Definition: item_sum.h:2095
bool distinct
True if GROUP CONCAT has the DISTINCT attribute.
Definition: item_sum.h:2098
TABLE * table
Temporary table used to perform group concat.
Definition: item_sum.h:2122
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:4064
double val_real() override
Definition: item_sum.cc:4692
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2162
String * val_str(String *str) override
Definition: item_sum.cc:4699
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:4100
bool force_copy_fields
Definition: item_sum.h:2131
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:4460
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2184
Unique * unique_filter
If DISTINCT is used with this GROUP_CONCAT, this member is used to filter out duplicates.
Definition: item_sum.h:2120
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2210
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:4395
Mem_root_array< ORDER > order_array
Definition: item_sum.h:2123
TREE tree_base
Definition: item_sum.h:2110
void update_field() override
Definition: item_sum.h:2169
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:4724
Temp_table_param * tmp_table_param
Describes the temporary table used to perform group concat.
Definition: item_sum.h:2108
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:4322
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:4387
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:4270
const char * func_name() const override
Definition: item_sum.h:2163
Item_result result_type() const override
Definition: item_sum.h:2164
Field * make_string_field(TABLE *table_arg) const override
Create a field to hold a string value from an item.
Definition: item_sum.cc:4354
uint m_order_arg_count
The number of ORDER BY items.
Definition: item_sum.h:2100
TREE * tree
Definition: item_sum.h:2111
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:4232
bool has_distinct() const noexcept
Definition: item_sum.h:2191
bool add() override
Definition: item_sum.cc:4409
Name_resolution_context * context
Resolver context, points to containing query block.
Definition: item_sum.h:2104
void reset_field() override
Definition: item_sum.h:2168
uint m_field_arg_count
The number of selected items, aka the concat field list.
Definition: item_sum.h:2102
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:2129
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2187
bool warning_for_row
Definition: item_sum.h:2130
String * separator
String containing separator between group items.
Definition: item_sum.h:2106
~Item_func_group_concat() override
Definition: item_sum.h:2155
const Mem_root_array< ORDER > & get_order_array() const noexcept
Definition: item_sum.h:2196
Class for implementation of the GROUPING function.
Definition: item_sum.h:2689
const Query_block * m_query_block
The query block in which this function is called.
Definition: item_sum.h:2704
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:6370
longlong val_int() override
Evaluation of the GROUPING function.
Definition: item_sum.cc:6319
Item_func_grouping(const POS &pos, PT_item_list *a)
Definition: item_sum.h:2691
const char * func_name() const override
Definition: item_sum.h:2694
bool fix_fields(THD *thd, Item **ref) override
Resolve the fields in the GROUPING function.
Definition: item_sum.cc:6264
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:6340
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_sum.cc:6382
enum Functype functype() const override
Definition: item_sum.h:2695
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:494
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:4277
void set_original_field_name(const char *name_arg)
Definition: item.h:4274
const char * original_table_name() const
Definition: item.h:4278
Definition: item_func.h:1020
LEAD/LAG window functions, cf.
Definition: item_sum.h:2455
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5577
bool has_value() const
Definition: item_sum.h:2529
bool m_is_lead
if true, the function is LEAD, else LAG
Definition: item_sum.h:2457
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:2513
const char * func_name() const override
Definition: item_sum.h:2489
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5730
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:5637
void set_use_default(bool value)
Definition: item_sum.h:2531
String * val_str(String *str) override
Definition: item_sum.cc:5717
bool m_use_default
execution state: use default value for current row
Definition: item_sum.h:2472
enum Item_result result_type() const override
Definition: item_sum.h:2502
Item_cache * m_default
Definition: item_sum.h:2461
bool compute()
Core logic of LEAD/LAG window functions.
Definition: item_sum.cc:5757
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:2476
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:5664
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2492
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5739
enum_null_treatment m_null_treatment
Definition: item_sum.h:2456
void clear() override
Definition: item_sum.cc:5676
bool use_default() const
Definition: item_sum.h:2532
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_sum.cc:5586
bool m_has_value
Execution state: if set, we already have a value for current row.
Definition: item_sum.h:2471
longlong val_int() override
Definition: item_sum.cc:5688
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5704
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5609
Item_result m_hybrid_type
Definition: item_sum.h:2459
int64 m_n
canonicalized offset value
Definition: item_sum.h:2458
double val_real() override
Definition: item_sum.cc:5696
void set_has_value(bool value)
Definition: item_sum.h:2528
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5527
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5747
bool setup_lead_lag()
Definition: item_sum.cc:5648
Item_cache * m_value
Definition: item_sum.h:2460
Item_non_framing_wf super
Definition: item_sum.h:2473
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:5683
Common parent class for window functions that always work on the entire partition,...
Definition: item_sum.h:2226
Item_non_framing_wf(const POS &pos, PT_window *w)
Definition: item_sum.h:2230
bool add() override
Definition: item_sum.h:2247
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2241
Item_non_framing_wf(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2231
Item_non_framing_wf(const POS &pos, PT_item_list *opt_list, PT_window *w)
Definition: item_sum.h:2233
Item_sum super
Definition: item_sum.h:2227
Item_non_framing_wf(THD *thd, Item_non_framing_wf *i)
Definition: item_sum.h:2235
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2237
void update_field() override
Definition: item_sum.h:2246
void reset_field() override
Definition: item_sum.h:2245
bool framing() const override
All aggregates are framing, i.e.
Definition: item_sum.h:2254
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:4760
NTH_VALUE window function, cf.
Definition: item_sum.h:2614
int64 m_cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2621
void update_field() override
Definition: item_sum.h:2661
bool compute()
Core logic of NTH_VALUE window functions.
Definition: item_sum.cc:5420
String * val_str(String *str) override
Definition: item_sum.cc:5487
Item_sum super
Definition: item_sum.h:2623
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5034
enum Item_result result_type() const override
Definition: item_sum.h:2649
Item_result m_hybrid_type
Definition: item_sum.h:2618
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5473
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5507
bool setup_nth()
Definition: item_sum.cc:5379
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5328
enum_field_types m_hybrid_field_type
Definition: item_sum.h:2619
int64 m_n
The N of the function.
Definition: item_sum.h:2616
double val_real() override
Definition: item_sum.cc:5463
bool m_from_last
true iff FROM_LAST was specified
Definition: item_sum.h:2617
Item_cache * m_value
Definition: item_sum.h:2620
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5517
enum_null_treatment m_null_treatment
Definition: item_sum.h:2615
void reset_field() override
Definition: item_sum.h:2660
longlong val_int() override
Definition: item_sum.cc:5453
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:2626
void clear() override
Definition: item_sum.cc:5390
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5314
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:5368
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2637
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:5396
bool add() override
Definition: item_sum.h:2662
const char * func_name() const override
Definition: item_sum.h:2636
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5497
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:5400
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2669
NTILE window function, cf.
Definition: item_sum.h:2418
void clear() override
Definition: item_sum.h:2448
Item_non_framing_wf super
Definition: item_sum.h:2419
String * val_str(String *) override
Definition: item_sum.cc:5113
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2431
const char * func_name() const override
Definition: item_sum.h:2428
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:2449
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5128
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5052
double val_real() override
Definition: item_sum.cc:5108
longlong val_int() override
Definition: item_sum.cc:5058
longlong m_value
Definition: item_sum.h:2420
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:5115
Item_ntile(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2423
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2429
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:5120
Item_result result_type() const override
Definition: item_sum.h:2447
PERCENT_RANK window function, cf.
Definition: item_sum.h:2377
String * val_str(String *) override
Definition: item_sum.cc:5017
Item_percent_rank(const POS &pos, PT_window *w)
Definition: item_sum.h:2388
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2380
const char * func_name() const override
Definition: item_sum.h:2395
Item_result result_type() const override
Definition: item_sum.h:2412
~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:4959
ulonglong m_peers
Needed to make PERCENT_RANK same for peers.
Definition: item_sum.h:2381
double val_real() override
Definition: item_sum.cc:4983
Item_non_framing_wf super
Definition: item_sum.h:2378
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2398
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2396
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:2405
bool m_last_peer_visited
Set when the last peer has been visited.
Definition: item_sum.h:2385
void clear() override
Definition: item_sum.cc:5026
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:5021
longlong val_int() override
Definition: item_sum.cc:5009
RANK or DENSE_RANK window function, cf.
Definition: item_sum.h:2297
Item_result result_type() const override
Definition: item_sum.h:2342
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:4815
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:4839
ulonglong m_duplicates
Needed to make RANK different from DENSE_RANK.
Definition: item_sum.h:2302
bool m_dense
If true, the object represents DENSE_RANK.
Definition: item_sum.h:2299
longlong val_int() override
Definition: item_sum.cc:4857
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2321
~Item_rank() override
Definition: item_sum.cc:4913
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2325
Item_rank(const POS &pos, bool dense, PT_window *w)
Definition: item_sum.h:2306
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4892
const char * func_name() const override
Definition: item_sum.h:2317
double val_real() override
Definition: item_sum.cc:4885
String * val_str(String *) override
Definition: item_sum.cc:4890
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2301
void clear() override
Clear state for a new partition.
Definition: item_sum.cc:4897
Mem_root_array< Cached_item * > m_previous
Values of previous row's ORDER BY items.
Definition: item_sum.h:2304
Item_non_framing_wf super
Definition: item_sum.h:2298
Item with result field.
Definition: item.h:5829
longlong llrint_with_overflow_check(double realval)
Definition: item.h:5868
A wrapper Item that contains a number of aggregate items, one for each level of rollup (see Item_roll...
Definition: item_sum.h:2714
table_map used_tables() const override
Definition: item_sum.h:2741
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:6458
void update_field() override
Definition: item_sum.h:2756
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2743
Item * get_arg(uint i) override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2778
Item * set_arg(THD *thd, uint i, Item *new_val) override
Definition: item_sum.h:2780
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.cc:6444
void set_current_rollup_level(int level)
Definition: item_sum.h:2790
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:6398
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:6449
bool aggregator_setup(THD *thd) override
Called to initialize the aggregator.
Definition: item_sum.cc:6491
Item_result result_type() const override
Definition: item_sum.h:2742
String * val_str(String *str) override
Definition: item_sum.cc:6423
int set_aggregator(Aggregator::Aggregator_type aggregator) override
Definition: item_sum.cc:6480
Item_sum * unwrap_sum() override
Non-const version.
Definition: item_sum.h:2795
longlong val_int() override
Definition: item_sum.cc:6416
void reset_field() override
Definition: item_sum.h:2755
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:2794
Item_rollup_sum_switcher(List< Item > *sum_func_per_level)
Definition: item_sum.h:2716
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:6404
bool aggregator_add_all()
Definition: item_sum.h:2767
Item * current_arg() const
Definition: item_sum.cc:6393
Item_sum * master() const
Definition: item_sum.h:2791
Item_sum * child(size_t i) const
Definition: item_sum.h:2799
enum Sumfunctype real_sum_func() const override
Definition: item_sum.h:2752
bool is_rollup_sum_wrapper() const override
Overridden by Item_rollup_sum_switcher.
Definition: item_sum.h:2793
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2751
const char * func_name() const override
Definition: item_sum.h:2740
int m_current_rollup_level
Definition: item_sum.h:2804
double val_real() override
Definition: item_sum.cc:6409
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_sum.cc:6437
uint argument_count() const override
Definition: item_sum.h:2787
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:6430
bool add() override
Definition: item_sum.h:2758
void clear() override
Definition: item_sum.cc:6462
bool reset_and_add_for_rollup(int last_unchanged_group_item_idx)
Definition: item_sum.cc:6468
const int m_num_levels
Definition: item_sum.h:2803
const Item * get_arg(uint i) const override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2779
ROW_NUMBER window function, cf.
Definition: item_sum.h:2260
ulonglong m_ctr
Increment for each row in partition.
Definition: item_sum.h:2262
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2273
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2271
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2287
Item_row_number(const POS &pos, PT_window *w)
Definition: item_sum.h:2265
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4808
Item_result result_type() const override
Definition: item_sum.h:2285
String * val_str(String *) override
Definition: item_sum.cc:4804
longlong val_int() override
Definition: item_sum.cc:4785
void clear() override
Definition: item_sum.cc:4813
const char * func_name() const override
Definition: item_sum.h:2270
double val_real() override
Definition: item_sum.cc:4799
Definition: item_sum.h:1903
Item_sum_and(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1905
const char * func_name() const override
Definition: item_sum.h:1909
Item_sum_and(THD *thd, Item_sum_and *item)
Definition: item_sum.h:1908
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3317
Definition: item_sum.h:1315
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2264
void clear() override
Definition: item_sum.cc:2320
String * val_str(String *str) override
Definition: item_sum.cc:2435
const char * func_name() const override
Definition: item_sum.h:1343
void update_field() override
calc next value and merge it with field_value.
Definition: item_sum.cc:3554
Item_sum_sum super
Definition: item_sum.h:1319
Item * result_item(Field *) override
Definition: item_sum.h:1342
double val_real() override
Definition: item_sum.cc:2329
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1346
Item_sum_avg(const POS &pos, Item *item_par, bool distinct, PT_window *w)
Definition: item_sum.h:1323
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:2298
my_decimal m_avg_dec
Definition: item_sum.h:1320
uint f_scale
Definition: item_sum.h:1318
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1330
double m_avg
Definition: item_sum.h:1321
longlong val_int() override
Definition: item_sum.h:1337
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2291
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2352
void reset_field() override
Definition: item_sum.cc:3452
uint prec_increment
Definition: item_sum.h:1317
uint dec_bin_size
Definition: item_sum.h:1318
bool add() override
Definition: item_sum.cc:2322
Item_sum_avg(THD *thd, Item_sum_avg *item)
Definition: item_sum.h:1326
uint f_precision
Definition: item_sum.h:1318
Base class used to implement BIT_AND, BIT_OR and BIT_XOR.
Definition: item_sum.h:1734
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3207
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:1843
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:1745
static constexpr uint DIGIT_CNT_CARD
Definition: item_sum.h:1788
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1830
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:1791
void clear() override
Definition: item_sum.cc:3289
Item * result_item(Field *) override
Definition: item_sum.h:1826
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:1476
longlong val_int() override
Definition: item_sum.cc:3265
Item_sum super
Definition: item_sum.h:1735
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:1780
Item_result hybrid_type
Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT.
Definition: item_sum.h:1743
ulonglong reset_bits
Stores the neutral element for function.
Definition: item_sum.h:1737
Item_sum_bit(const POS &pos, Item *item_par, ulonglong reset_arg, PT_window *w)
Definition: item_sum.h:1794
bool is_and() const
Definition: item_sum.h:1856
void reset_field() override
Definition: item_sum.cc:3482
ulonglong m_count
Execution state (windowing): this is for counting rows entering and leaving the window frame,...
Definition: item_sum.h:1751
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3214
double val_real() override
Definition: item_sum.cc:3239
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:3221
enum Item_result result_type() const override
Definition: item_sum.h:1831
uint m_digit_cnt_card
Definition: item_sum.h:1786
Item_sum_bit(THD *thd, Item_sum_bit *item)
Copy constructor, used for executing subqueries with temporary tables.
Definition: item_sum.h:1807
String * val_str(String *str) override
Definition: item_sum.cc:3176
void update_field() override
Definition: item_sum.cc:3492
ulonglong bits
Stores the result value for the INT_RESULT.
Definition: item_sum.h:1739
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:1759
String value_buff
Stores the result value for the STRING_RESULT.
Definition: item_sum.h:1741
Implements ST_Collect which aggregates geometries into Multipoints, Multilinestrings,...
Definition: item_sum.h:2809
bool add() override
Definition: item_sum.cc:6566
void clear() override
Definition: item_sum.cc:6560
void read_result_field()
Definition: item_sum.cc:6621
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:6529
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_sum.h:2829
std::optional< gis::srid_t > srid
Definition: item_sum.h:2811
Item_sum_collect(const POS &pos, Item *a, PT_window *w, bool distinct)
Definition: item_sum.h:2820
void update_field() override
Definition: item_sum.cc:6714
longlong val_int() override
Definition: item_sum.h:2827
bool get_time(MYSQL_TIME *) override
Definition: item_sum.h:2830
std::unique_ptr< gis::Geometrycollection > m_geometrycollection
Definition: item_sum.h:2812
String * val_str(String *str) override
Definition: item_sum.cc:6667
void reset_field() override
Definition: item_sum.cc:6777
Item_sum_collect(THD *thd, Item_sum *item)
Definition: item_sum.h:2817
void store_result_field()
Definition: item_sum.cc:6720
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:6772
bool check_wf_semantics1(THD *thd, Query_block *, Window_evaluation_requirements *r) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:6551
const char * func_name() const override
Definition: item_sum.h:2868
void pop_front()
Definition: item_sum.cc:6660
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2831
Item_result result_type() const override
Definition: item_sum.h:2832
int set_aggregator(Aggregator::Aggregator_type) override
Definition: item_sum.h:2833
double val_real() override
Definition: item_sum.h:2828
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6616
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:2226
void update_field() override
Definition: item_sum.cc:3545
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2207
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:2258
void make_const(longlong count_arg)
Definition: item_sum.h:1108
void reset_field() override
Definition: item_sum.cc:3444
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:2215
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:2217
Abstract base class for the MIN and MAX aggregate functions.
Definition: item_sum.h:1530
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3129
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:3124
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:1681
virtual Item_sum_hybrid * clone_hybrid(THD *thd) const =0
Create a clone of this object.
bool add() override
Definition: item_sum.cc:3159
const bool m_is_min
Tells if this is the MIN function (true) or the MAX function (false).
Definition: item_sum.h:1537
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3058
bool compute()
This function implements the optimized version of retrieving min/max value.
Definition: item_sum.cc:2860
bool has_values()
Definition: item_sum.h:1678
void min_max_update_int_field()
Definition: item_sum.cc:3676
longlong val_int() override
Definition: item_sum.cc:2993
bool m_has_values
Definition: item_sum.h:1549
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3048
void reset_field() override
Definition: item_sum.cc:3341
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:3095
void clear() override
Definition: item_sum.cc:2811
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:1577
Item_cache * arg_cache
Definition: item_sum.h:1546
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3110
void min_max_update_json_field()
Definition: item_sum.cc:3629
void update_field() override
Definition: item_sum.cc:3590
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_sum.cc:3019
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:2821
bool keep_field_type() const override
Definition: item_sum.h:1670
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3031
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:1571
void min_max_update_real_field()
Definition: item_sum.cc:3663
Item_sum_hybrid(THD *thd, const Item_sum_hybrid *item)
Definition: item_sum.h:1641
Item_result hybrid_type
Definition: item_sum.h:1548
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_sum.cc:3007
bool m_optimize
Set to true when min/max can be optimized using window's ordering.
Definition: item_sum.h:1557
Item_sum_hybrid(const POS &pos, Item *item_par, bool is_min, PT_window *w)
Definition: item_sum.h:1625
Item_sum_hybrid(Item *item_par, bool is_min)
Definition: item_sum.h:1609
Item_sum super
Definition: item_sum.h:1531
void min_max_update_temporal_field()
Definition: item_sum.cc:3611
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:2826
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:1782
String * val_str(String *) override
Definition: item_sum.cc:3068
Arg_comparator * cmp
Definition: item_sum.h:1547
void min_max_update_str_field()
Definition: item_sum.cc:3647
enum Item_result result_type() const override
Definition: item_sum.h:1671
void min_max_update_decimal_field()
Definition: item_sum.cc:3694
double val_real() override
Definition: item_sum.cc:2979
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:1565
Item_cache * value
Definition: item_sum.h:1546
bool m_nulls_first
Set to true if the window is ordered ascending.
Definition: item_sum.h:1553
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_sum.h:1672
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:3081
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:1259
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:6000
~Item_sum_json_array() override
bool add() override
Definition: item_sum.cc:6073
unique_ptr_destroy_only< Json_array > m_json_array
Accumulates the final value.
Definition: item_sum.h:1261
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6122
const char * func_name() const override
Definition: item_sum.h:1271
void clear() override
Definition: item_sum.cc:6015
Implements aggregation of values into an object.
Definition: item_sum.h:1278
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:6024
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6230
bool add() override
Definition: item_sum.cc:6135
unique_ptr_destroy_only< Json_object > m_json_object
Accumulates the final value.
Definition: item_sum.h:1280
~Item_sum_json_object() override
const char * func_name() const override
Definition: item_sum.h:1307
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:6049
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:1289
void clear() override
Definition: item_sum.cc:6039
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:1297
String m_tmp_key_value
Buffer used to get the value of the key.
Definition: item_sum.h:1282
Common abstraction for Item_sum_json_array and Item_sum_json_object.
Definition: item_sum.h:1215
void reset_field() override
Definition: item_sum.cc:5960
void update_field() override
Definition: item_sum.cc:5980
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5874
unique_ptr_destroy_only< Json_wrapper > m_wrapper
Wrapper around the container (object/array) which accumulates the value.
Definition: item_sum.h:1224
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1240
longlong val_int() override
Definition: item_sum.cc:5912
String m_value
String used when reading JSON binary values or JSON text values.
Definition: item_sum.h:1220
String m_conversion_buffer
String used for converting JSON text values to utf8mb4 charset.
Definition: item_sum.h:1222
Item_sum super
Definition: item_sum.h:1216
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5953
Item_sum_json(unique_ptr_destroy_only< Json_wrapper > wrapper, Args &&...parent_args)
Construct an Item_sum_json instance.
Definition: item_sum.cc:5815
~Item_sum_json() override
String * val_str(String *str) override
Definition: item_sum.cc:5855
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5927
Item_result result_type() const override
Definition: item_sum.h:1241
bool fix_fields(THD *thd, Item **pItem) override
Definition: item_sum.cc:5829
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5824
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5945
double val_real() override
Definition: item_sum.cc:5897
Definition: item_sum.h:1715
Item_sum_max(Item *item_par)
Definition: item_sum.h:1717
Item_sum_max(THD *thd, const Item_sum_max *item)
Definition: item_sum.h:1720
const char * func_name() const override
Definition: item_sum.h:1723
Item_sum_max * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3140
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1722
Item_sum_max(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1718
Definition: item_sum.h:1701
Item_sum_min(THD *thd, const Item_sum_min *item)
Definition: item_sum.h:1706
Item_sum_min(Item *item_par)
Definition: item_sum.h:1703
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1708
const char * func_name() const override
Definition: item_sum.h:1709
Item_sum_min(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1704
Item_sum_min * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3136
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:3328
Item_sum_num(const POS &pos, PT_item_list *list, PT_window *w)
Definition: item_sum.h:960
Definition: item_sum.h:1893
Item_sum_or(THD *thd, Item_sum_or *item)
Definition: item_sum.h:1898
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3303
const char * func_name() const override
Definition: item_sum.h:1899
Item_sum_or(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1895
Definition: item_sum.h:1508
double val_real() override
Definition: item_sum.cc:2445
Item_sum_std(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1510
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2454
Item_sum_std(THD *thd, Item_sum_std *item)
Definition: item_sum.h:1513
const char * func_name() const override
Definition: item_sum.h:1517
enum Item_result result_type() const override
Definition: item_sum.h:1521
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1514
Item * result_item(Field *) override
Definition: item_sum.h:1516
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:1962
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:1984
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:3423
String * val_str(String *str) override
Definition: item_sum.cc:2073
longlong val_int() override
Definition: item_sum.cc:2005
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:3516
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:2079
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:2029
Definition: item_sum.h:2061
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2072
longlong val_int() override
Definition: item_sum.cc:3975
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2075
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3977
Item_sum_udf_decimal(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2063
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3986
double val_real() override
Definition: item_sum.cc:3973
enum Item_result result_type() const override
Definition: item_sum.h:2078
String * val_str(String *) override
Definition: item_sum.cc:3969
Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
Definition: item_sum.h:2066
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2079
Definition: item_sum.h:1971
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1990
longlong val_int() override
Definition: item_sum.h:1977
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3965
String * val_str(String *str) override
Definition: item_sum.cc:3961
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3948
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1984
double val_real() override
Definition: item_sum.cc:3953
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
Definition: item_sum.h:1975
Item_sum_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1973
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1987
Definition: item_sum.h:1998
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2011
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
Definition: item_sum.h:2002
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2016
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2014
enum Item_result result_type() const override
Definition: item_sum.h:2015
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3990
String * val_str(String *str) override
Definition: item_sum.cc:4002
Item_sum_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2000
longlong val_int() override
Definition: item_sum.cc:3994
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:4006
double val_real() override
Definition: item_sum.h:2005
Definition: item_sum.h:2023
bool resolve_type(THD *) override
Default max_length is max argument length.
Definition: item_sum.cc:4012
double val_real() override
Definition: item_sum.h:2030
String * val_str(String *) override
Definition: item_sum.cc:4028
enum Item_result result_type() const override
Definition: item_sum.h:2056
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2050
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2053
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:4020
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:4024
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
Definition: item_sum.h:2027
longlong val_int() override
Definition: item_sum.h:2039
Item_sum_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2025
Definition: item_sum.h:1432
ulonglong count
Definition: item_sum.h:1443
void update_field() override
Definition: item_sum.cc:2785
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2653
double val_real() override
Definition: item_sum.cc:2730
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1479
void clear() override
Definition: item_sum.cc:2707
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2673
Item * result_item(Field *) override
Definition: item_sum.h:1469
Item_sum_variance(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1453
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1462
double recurrence_s
Definition: item_sum.h:1441
bool optimize
If set, uses a algorithm II mentioned in the class description to calculate the variance which helps ...
Definition: item_sum.h:1451
const char * func_name() const override
Definition: item_sum.h:1473
bool add() override
Definition: item_sum.cc:2709
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:1472
double recurrence_s2
Definition: item_sum.h:1442
Item_result hybrid_type
Definition: item_sum.h:1436
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:2637
double recurrence_m
Used in recurrence relation.
Definition: item_sum.h:1440
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2760
uint prec_increment
Definition: item_sum.h:1445
enum Item_result result_type() const override
Definition: item_sum.h:1478
void reset_field() override
Definition: item_sum.cc:2765
uint sample
Definition: item_sum.h:1444
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:2686
Definition: item_sum.h:1913
const char * func_name() const override
Definition: item_sum.h:1921
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3310
Item_sum_xor(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1915
Item_sum_xor(THD *thd, Item_sum_xor *item)
Definition: item_sum.h:1920
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:1929
udf_handler udf
Definition: item_sum.h:1933
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:3906
void update_field() override
Definition: item_sum.h:1965
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3928
void reset_field() override
Definition: item_sum.h:1964
bool add() override
Definition: item_sum.cc:3921
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.h:1950
Item_udf_sum(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1936
void clear() override
Definition: item_sum.cc:3915