1#ifndef ITEM_SUM_INCLUDED
2#define ITEM_SUM_INCLUDED
54#include "mysqld_error.h"
576 if (item ==
nullptr)
return nullptr;
600 bool eq(
const Item *item,
bool binary_cmp)
const override;
794 snprintf(buff,
sizeof(buff),
"%s as window function",
func_name());
911 void clear()
override;
913 void endup()
override;
1006 return static_cast<double>(
val_int());
1050 void clear()
override;
1051 bool add()
override;
1071 void clear()
override;
1072 bool add()
override;
1147 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1211 return "sum_bit_field";
1234 template <
typename... Args>
1236 Args &&... parent_args);
1272 const char *
func_name()
const override {
return "json_arrayagg"; }
1273 void clear()
override;
1274 bool add()
override;
1308 const char *
func_name()
const override {
return "json_objectagg"; }
1309 void clear()
override;
1310 bool add()
override;
1334 void clear()
override;
1335 bool add()
override;
1373 return "variance_field";
1377 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1471 void clear()
override;
1472 bool add()
override;
1480 return sample ?
"var_samp" :
"variance";
1508 pointer_cast<Check_function_as_value_generator_parameters *>(args);
1528 return sample ?
"stddev_samp" :
"std";
1666 void clear()
override;
1692 bool add()
override;
1842 void clear()
override;
1864 bool add()
override;
1919 const char *
func_name()
const override {
return "bit_and"; }
1931 const char *
func_name()
const override {
return "bit_xor"; }
1966 if (
udf.
fix_fields(thd,
this, this->arg_count, this->args))
return true;
1972 void clear()
override;
1973 bool add()
override;
2042 const char *end_not_used;
2046 &end_not_used, &err_not_used)
2057 return cs->cset->strtoll10(
cs, res->
ptr(), &
end, &err_not_used);
2173 const char *
func_name()
const override {
return "group_concat"; }
2176 void clear()
override;
2177 bool add()
override;
2188 const char *end_ptr = res->
ptr() + res->
length();
2216 context = pointer_cast<Item_ident::Change_context *>(arg)->m_context;
2280 const char *
func_name()
const override {
return "row_number"; }
2293 void clear()
override;
2328 return m_dense ?
"dense_rank" :
"rank";
2351 void clear()
override;
2364 const char *
func_name()
const override {
return "cume_dist"; }
2405 const char *
func_name()
const override {
return "percent_rank"; }
2417 void clear()
override;
2508 void clear()
override;
2577 return m_is_first ?
"first_value" :
"last_value";
2585 void clear()
override;
2646 const char *
func_name()
const override {
return "nth_value"; }
2653 void clear()
override;
2704 const char *
func_name()
const override {
return "grouping"; }
2727 :
Item_sum((*sum_func_per_level)[0]),
2729 args = (*THR_MALLOC)->ArrayAlloc<
Item *>(sum_func_per_level->
size());
2731 for (
Item &item : *sum_func_per_level) {
2750 const char *
func_name()
const override {
return "rollup_sum_switcher"; }
2767 void clear()
override;
2791 Item *ret =
nullptr;
2810 return down_cast<Item_sum *>(
args[i]);
2848 if (
aggr !=
nullptr) {
2854 return aggr ? false :
true;
2872 bool add()
override;
2877 void clear()
override;
2878 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:813
uint tree_key_length
Definition: item_sum.h:866
uint32 * field_lengths
Definition: item_sum.h:843
bool arg_is_null(bool use_null_value) override
NULLness of being-aggregated argument.
Definition: item_sum.cc:2176
bool endup_done
Definition: item_sum.h:824
Const_distinct
Definition: item_sum.h:868
@ CONST_NULL
Set to true if the result is known to be always NULL.
Definition: item_sum.h:879
@ CONST_NOT_NULL
Set to true if count distinct is on only const items.
Definition: item_sum.h:886
@ NOT_CONST
Definition: item_sum.h:869
static int composite_key_cmp(const void *arg, const void *a, const void *b)
Correctly compare composite keys.
Definition: item_sum.cc:973
void endup() override
Calculate the aggregate function value.
Definition: item_sum.cc:1354
~Aggregator_distinct() override
Definition: item_sum.cc:2126
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:897
double arg_val_real() override
Floating point value of being-aggregated argument.
Definition: item_sum.cc:2171
void clear() override
Invalidate calculated value and clear the distinct rows.
Definition: item_sum.cc:1253
bool setup(THD *) override
Called before feeding the first row.
Definition: item_sum.cc:1044
bool unique_walk_function(void *element)
Aggregate a distinct row from the distinct hash table.
Definition: item_sum.cc:2119
Unique * tree
Definition: item_sum.h:858
Temp_table_param * tmp_table_param
Definition: item_sum.h:849
bool add() override
Process incoming row.
Definition: item_sum.cc:1285
TABLE * table
Definition: item_sum.h:835
Aggregator_type Aggrtype() override
Definition: item_sum.h:908
my_decimal * arg_val_decimal(my_decimal *value) override
Decimal value of being-aggregated argument.
Definition: item_sum.cc:2166
enum Aggregator_distinct::Const_distinct const_distinct
Aggregator_distinct(Item_sum *sum)
Definition: item_sum.h:900
The pass-through aggregator.
Definition: item_sum.h:927
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:933
Aggregator_simple(Item_sum *sum)
Definition: item_sum.h:929
bool setup(THD *thd) override
Called before adding the first row.
Definition: item_sum.h:932
Aggregator_type Aggrtype() override
Definition: item_sum.h:930
my_decimal * arg_val_decimal(my_decimal *value) override
Decimal value of being-aggregated argument.
Definition: item_sum.cc:2143
void endup() override
Called when there are no more data and the final value is to be retrieved.
Definition: item_sum.h:935
double arg_val_real() override
Floating point value of being-aggregated argument.
Definition: item_sum.cc:2147
bool add() override
Called when there's a new value to be aggregated.
Definition: item_sum.h:934
bool arg_is_null(bool use_null_value) override
NULLness of being-aggregated argument.
Definition: item_sum.cc:2151
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:199
Definition: item_sum.h:1177
const char * func_name() const override
Definition: item_sum.h:1187
uint prec_increment
Definition: item_sum.h:1180
uint f_precision
Definition: item_sum.h:1179
uint dec_bin_size
Definition: item_sum.h:1179
uint f_scale
Definition: item_sum.h:1179
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3716
String * val_str(String *) override
Definition: item_sum.cc:3731
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1186
enum Type type() const override
Definition: item_sum.h:1182
double val_real() override
Definition: item_sum.cc:3701
Item_avg_field(Item_result res_type, Item_sum_avg *item)
Definition: item_sum.cc:3682
CUME_DIST window function, cf.
Definition: item_sum.h:2358
Item_cume_dist(const POS &pos, PT_window *w)
Definition: item_sum.h:2362
Item_non_framing_wf super
Definition: item_sum.h:2359
double val_real() override
Definition: item_sum.cc:4912
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2365
void clear() override
Definition: item_sum.h:2376
const char * func_name() const override
Definition: item_sum.h:2364
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:2375
String * val_str(String *) override
Definition: item_sum.cc:4932
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:4902
longlong val_int() override
Definition: item_sum.cc:4924
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2367
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:4936
Item_result result_type() const override
Definition: item_sum.h:2381
FIRST_VALUE/LAST_VALUE window functions, cf.
Definition: item_sum.h:2558
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2580
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5140
void reset_field() override
Definition: item_sum.h:2599
const char * func_name() const override
Definition: item_sum.h:2576
bool setup_first_last()
Definition: item_sum.cc:5181
double val_real() override
Definition: item_sum.cc:5230
String * val_str(String *str) override
Definition: item_sum.cc:5285
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:5198
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:5169
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
bool compute()
Core logic of FIRST/LAST_VALUE window functions.
Definition: item_sum.cc:5202
int64 cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2563
Item_result m_hybrid_type
Definition: item_sum.h:2561
enum Item_result result_type() const override
Definition: item_sum.h:2588
Item_cache * m_value
Definition: item_sum.h:2562
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5261
void update_field() override
Definition: item_sum.h:2600
enum_null_treatment m_null_treatment
Definition: item_sum.h:2560
Item_sum super
Definition: item_sum.h:2564
void clear() override
Definition: item_sum.cc:5192
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2608
bool add() override
Definition: item_sum.h:2601
Item_first_last_value(const POS &pos, bool first, Item *a, enum_null_treatment null_treatment, PT_window *w)
Definition: item_sum.h:2567
bool m_is_first
if true, the function is FIRST_VALUE, else LAST_VALUE
Definition: item_sum.h:2559
longlong val_int() override
Definition: item_sum.cc:5220
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5271
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5251
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5150
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5240
Definition: item_sum.h:2104
void clear() override
Definition: item_sum.cc:4379
bool m_result_finalized
True if result has been written to output buffer.
Definition: item_sum.h:2143
String result
Definition: item_sum.h:2119
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:2148
longlong val_int() override
Definition: item_sum.h:2184
const String * get_separator_str() const noexcept
Definition: item_sum.h:2202
uint32_t get_group_concat_max_len() const noexcept
Definition: item_sum.h:2203
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_sum.h:2191
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:4125
uint row_count
Definition: item_sum.h:2134
void make_unique() override
Definition: item_sum.cc:4666
bool change_context_processor(uchar *arg) override
Definition: item_sum.h:2215
bool setup(THD *thd) override
Definition: item_sum.cc:4535
Item_sum super
Definition: item_sum.h:2105
bool distinct
True if GROUP CONCAT has the DISTINCT attribute.
Definition: item_sum.h:2108
TABLE * table
Temporary table used to perform group concat.
Definition: item_sum.h:2132
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:4046
double val_real() override
Definition: item_sum.cc:4674
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2172
String * val_str(String *str) override
Definition: item_sum.cc:4681
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:4082
bool force_copy_fields
Definition: item_sum.h:2141
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:4442
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2194
Unique * unique_filter
If DISTINCT is used with this GROUP_CONCAT, this member is used to filter out duplicates.
Definition: item_sum.h:2130
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2220
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:4377
Mem_root_array< ORDER > order_array
Definition: item_sum.h:2133
TREE tree_base
Definition: item_sum.h:2120
void update_field() override
Definition: item_sum.h:2179
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:4706
Temp_table_param * tmp_table_param
Describes the temporary table used to perform group concat.
Definition: item_sum.h:2118
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:4304
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:4369
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:4252
const char * func_name() const override
Definition: item_sum.h:2173
Item_result result_type() const override
Definition: item_sum.h:2174
Field * make_string_field(TABLE *table_arg) const override
Create a field to hold a string value from an item.
Definition: item_sum.cc:4336
uint m_order_arg_count
The number of ORDER BY items.
Definition: item_sum.h:2110
TREE * tree
Definition: item_sum.h:2121
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:4214
bool has_distinct() const noexcept
Definition: item_sum.h:2201
bool add() override
Definition: item_sum.cc:4391
Name_resolution_context * context
Resolver context, points to containing query block.
Definition: item_sum.h:2114
void reset_field() override
Definition: item_sum.h:2178
uint m_field_arg_count
The number of selected items, aka the concat field list.
Definition: item_sum.h:2112
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:2139
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2197
bool warning_for_row
Definition: item_sum.h:2140
String * separator
String containing separator between group items.
Definition: item_sum.h:2116
~Item_func_group_concat() override
Definition: item_sum.h:2165
const Mem_root_array< ORDER > & get_order_array() const noexcept
Definition: item_sum.h:2206
Class for implementation of the GROUPING function.
Definition: item_sum.h:2699
const Query_block * m_query_block
The query block in which this function is called.
Definition: item_sum.h:2714
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:6344
longlong val_int() override
Evaluation of the GROUPING function.
Definition: item_sum.cc:6293
Item_func_grouping(const POS &pos, PT_item_list *a)
Definition: item_sum.h:2701
const char * func_name() const override
Definition: item_sum.h:2704
bool fix_fields(THD *thd, Item **ref) override
Resolve the fields in the GROUPING function.
Definition: item_sum.cc:6238
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:6314
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_sum.cc:6356
enum Functype functype() const override
Definition: item_sum.h:2705
Definition: item_func.h:102
Item ** args
Array of pointers to arguments.
Definition: item_func.h:109
virtual Item * get_arg(uint i)
Get the i'th argument of the function that this object represents.
Definition: item_func.h:461
Functype
Definition: item_func.h:187
@ GROUPING_FUNC
Definition: item_func.h:241
virtual uint argument_count() const
Definition: item_func.h:133
table_map used_tables_cache
Value used in calculation of result of used_tables()
Definition: item_func.h:171
bool param_type_is_default(THD *thd, uint start, uint end, uint step, enum_field_types def)
For arguments of this Item_func ("args" array), in range [start, start+step, start+2*step,...
Definition: item_func.cc:527
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:503
Item ** arguments() const
Definition: item_func.h:134
virtual void fix_num_length_and_dec()
Definition: item_func.cc:862
const char * original_db_name() const
Definition: item.h:4231
void set_original_field_name(const char *name_arg)
Definition: item.h:4228
const char * original_table_name() const
Definition: item.h:4232
Definition: item_func.h:983
LEAD/LAG window functions, cf.
Definition: item_sum.h:2465
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5556
bool has_value() const
Definition: item_sum.h:2539
bool m_is_lead
if true, the function is LEAD, else LAG
Definition: item_sum.h:2467
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:2523
const char * func_name() const override
Definition: item_sum.h:2499
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5704
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:5616
void set_use_default(bool value)
Definition: item_sum.h:2541
String * val_str(String *str) override
Definition: item_sum.cc:5696
bool m_use_default
execution state: use default value for current row
Definition: item_sum.h:2482
enum Item_result result_type() const override
Definition: item_sum.h:2512
Item_cache * m_default
Definition: item_sum.h:2471
bool compute()
Core logic of LEAD/LAG window functions.
Definition: item_sum.cc:5731
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:2486
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:5643
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2502
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5713
enum_null_treatment m_null_treatment
Definition: item_sum.h:2466
void clear() override
Definition: item_sum.cc:5655
bool use_default() const
Definition: item_sum.h:2542
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_sum.cc:5565
bool m_has_value
Execution state: if set, we already have a value for current row.
Definition: item_sum.h:2481
longlong val_int() override
Definition: item_sum.cc:5667
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5683
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5588
Item_result m_hybrid_type
Definition: item_sum.h:2469
int64 m_n
canonicalized offset value
Definition: item_sum.h:2468
double val_real() override
Definition: item_sum.cc:5675
void set_has_value(bool value)
Definition: item_sum.h:2538
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5507
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5721
bool setup_lead_lag()
Definition: item_sum.cc:5627
Item_cache * m_value
Definition: item_sum.h:2470
Item_non_framing_wf super
Definition: item_sum.h:2483
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:5662
Common parent class for window functions that always work on the entire partition,...
Definition: item_sum.h:2236
Item_non_framing_wf(const POS &pos, PT_window *w)
Definition: item_sum.h:2240
bool add() override
Definition: item_sum.h:2257
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2251
Item_non_framing_wf(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2241
Item_non_framing_wf(const POS &pos, PT_item_list *opt_list, PT_window *w)
Definition: item_sum.h:2243
Item_sum super
Definition: item_sum.h:2237
Item_non_framing_wf(THD *thd, Item_non_framing_wf *i)
Definition: item_sum.h:2245
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2247
void update_field() override
Definition: item_sum.h:2256
void reset_field() override
Definition: item_sum.h:2255
bool framing() const override
All aggregates are framing, i.e.
Definition: item_sum.h:2264
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:4742
NTH_VALUE window function, cf.
Definition: item_sum.h:2624
int64 m_cnt
used when evaluating on-the-fly (non-buffered processing)
Definition: item_sum.h:2631
void update_field() override
Definition: item_sum.h:2671
bool compute()
Core logic of NTH_VALUE window functions.
Definition: item_sum.cc:5400
String * val_str(String *str) override
Definition: item_sum.cc:5467
Item_sum super
Definition: item_sum.h:2633
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5016
enum Item_result result_type() const override
Definition: item_sum.h:2659
Item_result m_hybrid_type
Definition: item_sum.h:2628
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5453
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5487
bool setup_nth()
Definition: item_sum.cc:5359
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5308
enum_field_types m_hybrid_field_type
Definition: item_sum.h:2629
int64 m_n
The N of the function.
Definition: item_sum.h:2626
double val_real() override
Definition: item_sum.cc:5443
bool m_from_last
true iff FROM_LAST was specified
Definition: item_sum.h:2627
Item_cache * m_value
Definition: item_sum.h:2630
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5497
enum_null_treatment m_null_treatment
Definition: item_sum.h:2625
void reset_field() override
Definition: item_sum.h:2670
longlong val_int() override
Definition: item_sum.cc:5433
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:2636
void clear() override
Definition: item_sum.cc:5370
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:5295
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:5348
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2647
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:5376
bool add() override
Definition: item_sum.h:2672
const char * func_name() const override
Definition: item_sum.h:2646
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5477
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:5380
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:2679
NTILE window function, cf.
Definition: item_sum.h:2428
void clear() override
Definition: item_sum.h:2458
Item_non_framing_wf super
Definition: item_sum.h:2429
String * val_str(String *) override
Definition: item_sum.cc:5095
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2441
const char * func_name() const override
Definition: item_sum.h:2438
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:2459
bool check_wf_semantics2(Window_evaluation_requirements *reqs) override
Like check_wf_semantics1.
Definition: item_sum.cc:5110
bool fix_fields(THD *thd, Item **items) override
Definition: item_sum.cc:5034
double val_real() override
Definition: item_sum.cc:5090
longlong val_int() override
Definition: item_sum.cc:5040
longlong m_value
Definition: item_sum.h:2430
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:5097
Item_ntile(const POS &pos, Item *a, PT_window *w)
Definition: item_sum.h:2433
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2439
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:5102
Item_result result_type() const override
Definition: item_sum.h:2457
PERCENT_RANK window function, cf.
Definition: item_sum.h:2387
String * val_str(String *) override
Definition: item_sum.cc:4999
Item_percent_rank(const POS &pos, PT_window *w)
Definition: item_sum.h:2398
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2390
const char * func_name() const override
Definition: item_sum.h:2405
Item_result result_type() const override
Definition: item_sum.h:2422
~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:4941
ulonglong m_peers
Needed to make PERCENT_RANK same for peers.
Definition: item_sum.h:2391
double val_real() override
Definition: item_sum.cc:4965
Item_non_framing_wf super
Definition: item_sum.h:2388
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2408
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2406
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:2415
bool m_last_peer_visited
Set when the last peer has been visited.
Definition: item_sum.h:2395
void clear() override
Definition: item_sum.cc:5008
my_decimal * val_decimal(my_decimal *buffer) override
Definition: item_sum.cc:5003
longlong val_int() override
Definition: item_sum.cc:4991
RANK or DENSE_RANK window function, cf.
Definition: item_sum.h:2307
Item_result result_type() const override
Definition: item_sum.h:2352
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:4797
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:4821
ulonglong m_duplicates
Needed to make RANK different from DENSE_RANK.
Definition: item_sum.h:2312
bool m_dense
If true, the object represents DENSE_RANK.
Definition: item_sum.h:2309
longlong val_int() override
Definition: item_sum.cc:4839
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2331
~Item_rank() override
Definition: item_sum.cc:4895
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2335
Item_rank(const POS &pos, bool dense, PT_window *w)
Definition: item_sum.h:2316
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4874
const char * func_name() const override
Definition: item_sum.h:2327
double val_real() override
Definition: item_sum.cc:4867
String * val_str(String *) override
Definition: item_sum.cc:4872
ulonglong m_rank_ctr
Increment when window order columns change.
Definition: item_sum.h:2311
void clear() override
Clear state for a new partition.
Definition: item_sum.cc:4879
Mem_root_array< Cached_item * > m_previous
Values of previous row's ORDER BY items.
Definition: item_sum.h:2314
Item_non_framing_wf super
Definition: item_sum.h:2308
Item with result field.
Definition: item.h:5809
longlong llrint_with_overflow_check(double realval)
Definition: item.h:5860
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item.cc:10928
virtual const char * func_name() const =0
A wrapper Item that contains a number of aggregate items, one for each level of rollup (see Item_roll...
Definition: item_sum.h:2724
table_map used_tables() const override
Definition: item_sum.h:2751
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:6432
void update_field() override
Definition: item_sum.h:2766
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2753
Item * get_arg(uint i) override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2788
Item * set_arg(THD *thd, uint i, Item *new_val) override
Definition: item_sum.h:2790
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.cc:6418
void set_current_rollup_level(int level)
Definition: item_sum.h:2800
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:6372
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:6423
bool aggregator_setup(THD *thd) override
Called to initialize the aggregator.
Definition: item_sum.cc:6465
Item_result result_type() const override
Definition: item_sum.h:2752
String * val_str(String *str) override
Definition: item_sum.cc:6397
int set_aggregator(Aggregator::Aggregator_type aggregator) override
Definition: item_sum.cc:6454
Item_sum * unwrap_sum() override
Non-const version.
Definition: item_sum.h:2805
longlong val_int() override
Definition: item_sum.cc:6390
void reset_field() override
Definition: item_sum.h:2765
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:2804
Item_rollup_sum_switcher(List< Item > *sum_func_per_level)
Definition: item_sum.h:2726
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:6378
bool aggregator_add_all()
Definition: item_sum.h:2777
Item * current_arg() const
Definition: item_sum.cc:6367
Item_sum * master() const
Definition: item_sum.h:2801
Item_sum * child(size_t i) const
Definition: item_sum.h:2809
enum Sumfunctype real_sum_func() const override
Definition: item_sum.h:2762
bool is_rollup_sum_wrapper() const override
Overridden by Item_rollup_sum_switcher.
Definition: item_sum.h:2803
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2761
const char * func_name() const override
Definition: item_sum.h:2750
int m_current_rollup_level
Definition: item_sum.h:2814
double val_real() override
Definition: item_sum.cc:6383
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_sum.cc:6411
uint argument_count() const override
Definition: item_sum.h:2797
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:6404
bool add() override
Definition: item_sum.h:2768
void clear() override
Definition: item_sum.cc:6436
bool reset_and_add_for_rollup(int last_unchanged_group_item_idx)
Definition: item_sum.cc:6442
const int m_num_levels
Definition: item_sum.h:2813
const Item * get_arg(uint i) const override
Get the i'th argument of the function that this object represents.
Definition: item_sum.h:2789
ROW_NUMBER window function, cf.
Definition: item_sum.h:2270
ulonglong m_ctr
Increment for each row in partition.
Definition: item_sum.h:2272
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2283
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2281
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.h:2297
Item_row_number(const POS &pos, PT_window *w)
Definition: item_sum.h:2275
my_decimal * val_decimal(my_decimal *buff) override
Definition: item_sum.cc:4790
Item_result result_type() const override
Definition: item_sum.h:2295
String * val_str(String *) override
Definition: item_sum.cc:4786
longlong val_int() override
Definition: item_sum.cc:4767
void clear() override
Definition: item_sum.cc:4795
const char * func_name() const override
Definition: item_sum.h:2280
double val_real() override
Definition: item_sum.cc:4781
Definition: item_sum.h:1495
enum Type type() const override
Definition: item_sum.h:1498
Item_std_field(Item_sum_std *item)
Definition: item_sum.cc:3829
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:1506
enum Item_result result_type() const override
Definition: item_sum.h:1501
double val_real() override
Definition: item_sum.cc:3832
const char * func_name() const override
Definition: item_sum.h:1502
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3840
Definition: item_sum.h:1913
Item_sum_and(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1915
const char * func_name() const override
Definition: item_sum.h:1919
Item_sum_and(THD *thd, Item_sum_and *item)
Definition: item_sum.h:1918
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3297
Definition: item_sum.h:1316
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2244
void clear() override
Definition: item_sum.cc:2299
String * val_str(String *str) override
Definition: item_sum.cc:2414
const char * func_name() const override
Definition: item_sum.h:1346
void update_field() override
calc next value and merge it with field_value.
Definition: item_sum.cc:3526
Item_sum_sum super
Definition: item_sum.h:1320
Item * result_item(Field *) override
Definition: item_sum.h:1343
double val_real() override
Definition: item_sum.cc:2308
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1349
Item_sum_avg(const POS &pos, Item *item_par, bool distinct, PT_window *w)
Definition: item_sum.h:1324
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:2277
my_decimal m_avg_dec
Definition: item_sum.h:1321
uint f_scale
Definition: item_sum.h:1319
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1331
double m_avg
Definition: item_sum.h:1322
longlong val_int() override
Definition: item_sum.h:1338
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2270
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2331
void reset_field() override
Definition: item_sum.cc:3426
uint prec_increment
Definition: item_sum.h:1318
uint dec_bin_size
Definition: item_sum.h:1319
bool add() override
Definition: item_sum.cc:2301
Item_sum_avg(THD *thd, Item_sum_avg *item)
Definition: item_sum.h:1327
uint f_precision
Definition: item_sum.h:1319
This is used in connection with an Item_sum_bit,.
Definition: item_sum.h:1194
double val_real() override
Definition: item_sum.cc:3772
enum Type type() const override
Definition: item_sum.h:1208
ulonglong reset_bits
Definition: item_sum.h:1196
Item_sum_bit_field(Item_result res_type, Item_sum_bit *item, ulonglong reset_bits)
Definition: item_sum.cc:3737
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1205
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3789
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3815
longlong val_int() override
Definition: item_sum.cc:3757
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3822
String * val_str(String *) override
Definition: item_sum.cc:3797
const char * func_name() const override
Definition: item_sum.h:1209
Base class used to implement BIT_AND, BIT_OR and BIT_XOR.
Definition: item_sum.h:1744
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3186
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:1616
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1853
void remove_bits(const String *s1, ulonglong b1)
For windowing: perform inverse aggregation.
Definition: item_sum.cc:1538
const char initial_value_buff_storage[1]
Buffer used to avoid String allocation in the constructor.
Definition: item_sum.h:1755
static constexpr uint DIGIT_CNT_CARD
Definition: item_sum.h:1798
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1840
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:1482
bool m_is_xor
true iff BIT_XOR
Definition: item_sum.h:1801
void clear() override
Definition: item_sum.cc:3269
Item * result_item(Field *) override
Definition: item_sum.h:1836
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:1457
longlong val_int() override
Definition: item_sum.cc:3244
Item_sum super
Definition: item_sum.h:1745
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:1790
Item_result hybrid_type
Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT.
Definition: item_sum.h:1753
ulonglong reset_bits
Stores the neutral element for function.
Definition: item_sum.h:1747
Item_sum_bit(const POS &pos, Item *item_par, ulonglong reset_arg, PT_window *w)
Definition: item_sum.h:1804
bool is_and() const
Definition: item_sum.h:1866
void reset_field() override
Definition: item_sum.cc:3454
ulonglong m_count
Execution state (windowing): this is for counting rows entering and leaving the window frame,...
Definition: item_sum.h:1761
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3193
double val_real() override
Definition: item_sum.cc:3218
bool add() override
Common implementation of Item_sum_or::add, Item_sum_and:add and Item_sum_xor::add.
Definition: item_sum.cc:1700
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_sum.cc:3200
enum Item_result result_type() const override
Definition: item_sum.h:1841
uint m_digit_cnt_card
Definition: item_sum.h:1796
Item_sum_bit(THD *thd, Item_sum_bit *item)
Copy constructor, used for executing subqueries with temporary tables.
Definition: item_sum.h:1817
String * val_str(String *str) override
Definition: item_sum.cc:3155
void update_field() override
Definition: item_sum.cc:3464
ulonglong bits
Stores the result value for the INT_RESULT.
Definition: item_sum.h:1749
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:1769
String value_buff
Stores the result value for the STRING_RESULT.
Definition: item_sum.h:1751
Implements ST_Collect which aggregates geometries into Multipoints, Multilinestrings,...
Definition: item_sum.h:2819
bool add() override
Definition: item_sum.cc:6540
void clear() override
Definition: item_sum.cc:6534
void read_result_field()
Definition: item_sum.cc:6595
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:6503
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_sum.h:2839
std::optional< gis::srid_t > srid
Definition: item_sum.h:2821
Item_sum_collect(const POS &pos, Item *a, PT_window *w, bool distinct)
Definition: item_sum.h:2830
void update_field() override
Definition: item_sum.cc:6688
longlong val_int() override
Definition: item_sum.h:2837
bool get_time(MYSQL_TIME *) override
Definition: item_sum.h:2840
std::unique_ptr< gis::Geometrycollection > m_geometrycollection
Definition: item_sum.h:2822
String * val_str(String *str) override
Definition: item_sum.cc:6641
void reset_field() override
Definition: item_sum.cc:6751
Item_sum_collect(THD *thd, Item_sum *item)
Definition: item_sum.h:2827
void store_result_field()
Definition: item_sum.cc:6694
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:6746
bool check_wf_semantics1(THD *thd, Query_block *, Window_evaluation_requirements *r) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:6525
const char * func_name() const override
Definition: item_sum.h:2878
void pop_front()
Definition: item_sum.cc:6634
enum Sumfunctype sum_func() const override
Definition: item_sum.h:2841
Item_result result_type() const override
Definition: item_sum.h:2842
int set_aggregator(Aggregator::Aggregator_type) override
Definition: item_sum.h:2843
double val_real() override
Definition: item_sum.h:2838
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6590
Definition: item_sum.h:1066
longlong count
Definition: item_sum.h:1067
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1098
longlong val_int() override
Definition: item_sum.cc:2206
void update_field() override
Definition: item_sum.cc:3517
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2187
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1095
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:2238
void make_const(longlong count_arg)
Definition: item_sum.h:1105
void reset_field() override
Definition: item_sum.cc:3418
Item_sum_count(Item_int *number)
Definition: item_sum.h:1078
Item_sum_count(THD *thd, Item_sum_count *item)
Definition: item_sum.h:1093
Item_sum_count(const POS &pos, PT_item_list *list, PT_window *w)
Constructs an instance for COUNT(DISTINCT)
Definition: item_sum.h:1089
void clear() override
Definition: item_sum.cc:2195
const char * func_name() const override
Definition: item_sum.h:1112
Item_sum_count(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1076
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:1104
bool add() override
Definition: item_sum.cc:2197
This is used in connection which a parent Item_sum:
Definition: item_sum.h:1129
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1151
Item_result hybrid_type
Stores the Item's result type.
Definition: item_sum.h:1134
enum Item_result result_type() const override
Definition: item_sum.h:1137
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:1145
Field * field
The tmp table's column containing the value of the set function.
Definition: item_sum.h:1132
bool mark_field_in_map(uchar *arg) override
Mark underlying field in read or write map of a table.
Definition: item_sum.h:1138
Abstract base class for the MIN and MAX aggregate functions.
Definition: item_sum.h:1540
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3108
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:3103
bool setup_hybrid(Item *item, Item *value_arg)
MIN/MAX function setup.
Definition: item_sum.cc:1792
bool uses_only_one_row() const override
Only for framing window functions.
Definition: item_sum.h:1691
virtual Item_sum_hybrid * clone_hybrid(THD *thd) const =0
Create a clone of this object.
bool add() override
Definition: item_sum.cc:3138
const bool m_is_min
Tells if this is the MIN function (true) or the MAX function (false).
Definition: item_sum.h:1547
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:3037
bool compute()
This function implements the optimized version of retrieving min/max value.
Definition: item_sum.cc:2839
bool has_values()
Definition: item_sum.h:1688
void min_max_update_int_field()
Definition: item_sum.cc:3648
longlong val_int() override
Definition: item_sum.cc:2972
bool m_has_values
Definition: item_sum.h:1559
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:3027
void reset_field() override
Definition: item_sum.cc:3321
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:3074
void clear() override
Definition: item_sum.cc:2790
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:1587
Item_cache * arg_cache
Definition: item_sum.h:1556
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3089
void min_max_update_json_field()
Definition: item_sum.cc:3601
void update_field() override
Definition: item_sum.cc:3562
longlong val_date_temporal() override
Return date value of item in packed longlong format.
Definition: item_sum.cc:2998
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:2800
bool keep_field_type() const override
Definition: item_sum.h:1680
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3010
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:1581
void min_max_update_real_field()
Definition: item_sum.cc:3635
Item_sum_hybrid(THD *thd, const Item_sum_hybrid *item)
Definition: item_sum.h:1651
Item_result hybrid_type
Definition: item_sum.h:1558
longlong val_time_temporal() override
Return time value of item in packed longlong format.
Definition: item_sum.cc:2986
bool m_optimize
Set to true when min/max can be optimized using window's ordering.
Definition: item_sum.h:1567
Item_sum_hybrid(const POS &pos, Item *item_par, bool is_min, PT_window *w)
Definition: item_sum.h:1635
Item_sum_hybrid(Item *item_par, bool is_min)
Definition: item_sum.h:1619
Item_sum super
Definition: item_sum.h:1541
void min_max_update_temporal_field()
Definition: item_sum.cc:3583
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:2805
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:1761
String * val_str(String *) override
Definition: item_sum.cc:3047
Arg_comparator * cmp
Definition: item_sum.h:1557
void min_max_update_str_field()
Definition: item_sum.cc:3619
enum Item_result result_type() const override
Definition: item_sum.h:1681
void min_max_update_decimal_field()
Definition: item_sum.cc:3666
double val_real() override
Definition: item_sum.cc:2958
Field * create_tmp_field(bool group, TABLE *table) override
Definition: item_sum.cc:1809
bool m_want_first
For min() - Set to true when results are ordered in ascending and false when descending.
Definition: item_sum.h:1575
Item_cache * value
Definition: item_sum.h:1556
bool m_nulls_first
Set to true if the window is ordered ascending.
Definition: item_sum.h:1563
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_sum.h:1682
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:3060
Definition: item_sum.h:984
Item_sum_int(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:986
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1010
Item_sum_int(THD *thd, Item_sum_int *item)
Definition: item_sum.h:996
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1013
double val_real() override
Definition: item_sum.h:1004
Item_sum_int(Item *item_par)
Definition: item_sum.h:1000
enum Item_result result_type() const override
Definition: item_sum.h:1014
String * val_str(String *str) override
Definition: item_sum.cc:1424
Item_sum_int(const POS &pos, PT_item_list *list, PT_window *w)
Definition: item_sum.h:991
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:1426
Implements aggregation of values into an array.
Definition: item_sum.h:1260
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:5974
~Item_sum_json_array() override
bool add() override
Definition: item_sum.cc:6047
unique_ptr_destroy_only< Json_array > m_json_array
Accumulates the final value.
Definition: item_sum.h:1262
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6096
const char * func_name() const override
Definition: item_sum.h:1272
void clear() override
Definition: item_sum.cc:5989
Implements aggregation of values into an object.
Definition: item_sum.h:1279
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:5998
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:6204
bool add() override
Definition: item_sum.cc:6109
unique_ptr_destroy_only< Json_object > m_json_object
Accumulates the final value.
Definition: item_sum.h:1281
~Item_sum_json_object() override
const char * func_name() const override
Definition: item_sum.h:1308
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:6023
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:1290
void clear() override
Definition: item_sum.cc:6013
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:1298
String m_tmp_key_value
Buffer used to get the value of the key.
Definition: item_sum.h:1283
Common abstraction for Item_sum_json_array and Item_sum_json_object.
Definition: item_sum.h:1216
void reset_field() override
Definition: item_sum.cc:5934
void update_field() override
Definition: item_sum.cc:5954
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_sum.cc:5848
unique_ptr_destroy_only< Json_wrapper > m_wrapper
Wrapper around the container (object/array) which accumulates the value.
Definition: item_sum.h:1225
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1241
longlong val_int() override
Definition: item_sum.cc:5886
String m_value
String used when reading JSON binary values or JSON text values.
Definition: item_sum.h:1221
String m_conversion_buffer
String used for converting JSON text values to utf8mb4 charset.
Definition: item_sum.h:1223
Item_sum super
Definition: item_sum.h:1217
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.cc:5927
~Item_sum_json() override
String * val_str(String *str) override
Definition: item_sum.cc:5829
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_sum.cc:5901
Item_result result_type() const override
Definition: item_sum.h:1242
bool fix_fields(THD *thd, Item **pItem) override
Definition: item_sum.cc:5803
bool check_wf_semantics1(THD *, Query_block *, Window_evaluation_requirements *) override
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:5798
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.cc:5919
Item_sum_json(unique_ptr_destroy_only< Json_wrapper > wrapper, Args &&... parent_args)
Construct an Item_sum_json instance.
Definition: item_sum.cc:5789
double val_real() override
Definition: item_sum.cc:5871
Definition: item_sum.h:1725
Item_sum_max(Item *item_par)
Definition: item_sum.h:1727
Item_sum_max(THD *thd, const Item_sum_max *item)
Definition: item_sum.h:1730
const char * func_name() const override
Definition: item_sum.h:1733
Item_sum_max * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3119
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1732
Item_sum_max(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1728
Definition: item_sum.h:1711
Item_sum_min(THD *thd, const Item_sum_min *item)
Definition: item_sum.h:1716
Item_sum_min(Item *item_par)
Definition: item_sum.h:1713
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1718
const char * func_name() const override
Definition: item_sum.h:1719
Item_sum_min(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1714
Item_sum_min * clone_hybrid(THD *thd) const override
Create a clone of this object.
Definition: item_sum.cc:3115
Common abstract class for: Item_avg_field Item_variance_field.
Definition: item_sum.h:1162
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1168
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.h:1174
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1171
longlong val_int() override
Definition: item_sum.h:1164
Definition: item_sum.h:941
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:1420
Item_sum_num(THD *thd, Item_sum_num *item)
Definition: item_sum.h:960
bool fix_fields(THD *, Item **) override
Definition: item_sum.cc:1430
longlong val_int() override
Definition: item_sum.h:969
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_sum.h:962
String * val_str(String *str) override
Definition: item_sum.cc:1418
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:975
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:978
Item_sum super
Definition: item_sum.h:942
Item_sum_num(Item *item_par)
Definition: item_sum.h:966
bool is_evaluated
Definition: item_sum.h:951
Item_sum_num(const POS &pos, Item *item_par, PT_window *window)
Definition: item_sum.h:954
void reset_field() override
Definition: item_sum.cc:3308
Item_sum_num(const POS &pos, PT_item_list *list, PT_window *w)
Definition: item_sum.h:957
Definition: item_sum.h:1903
Item_sum_or(THD *thd, Item_sum_or *item)
Definition: item_sum.h:1908
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3283
const char * func_name() const override
Definition: item_sum.h:1909
Item_sum_or(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1905
Definition: item_sum.h:1518
double val_real() override
Definition: item_sum.cc:2424
Item_sum_std(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1520
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2433
Item_sum_std(THD *thd, Item_sum_std *item)
Definition: item_sum.h:1523
const char * func_name() const override
Definition: item_sum.h:1527
enum Item_result result_type() const override
Definition: item_sum.h:1531
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1524
Item * result_item(Field *) override
Definition: item_sum.h:1526
Definition: item_sum.h:1017
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:1028
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:1942
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:1873
enum Item_result result_type() const override
Definition: item_sum.h:1056
double sum
Definition: item_sum.h:1020
bool add() override
Definition: item_sum.cc:1964
Item_result hybrid_type
Definition: item_sum.h:1019
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.cc:1892
void reset_field() override
Definition: item_sum.cc:3400
String * val_str(String *str) override
Definition: item_sum.cc:2053
longlong val_int() override
Definition: item_sum.cc:1985
my_decimal dec_buffs[2]
Definition: item_sum.h:1021
void clear() override
Definition: item_sum.cc:1880
const char * func_name() const override
Definition: item_sum.h:1062
Item_sum_sum(const POS &pos, Item *item_par, bool distinct, PT_window *window)
Definition: item_sum.h:1038
void update_field() override
calc next value and merge it with field_value.
Definition: item_sum.cc:3488
uint curr_dec_buff
Definition: item_sum.h:1022
ulonglong m_frame_null_count
Execution state: this is for counting NULLs of rows entering and leaving the window frame,...
Definition: item_sum.h:1035
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2059
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:1894
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1047
double val_real() override
Definition: item_sum.cc:2009
Definition: item_sum.h:2071
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2082
longlong val_int() override
Definition: item_sum.cc:3957
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2085
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3959
Item_sum_udf_decimal(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2073
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3968
double val_real() override
Definition: item_sum.cc:3955
enum Item_result result_type() const override
Definition: item_sum.h:2088
String * val_str(String *) override
Definition: item_sum.cc:3951
Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
Definition: item_sum.h:2076
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2089
Definition: item_sum.h:1981
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2000
longlong val_int() override
Definition: item_sum.h:1987
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3947
String * val_str(String *str) override
Definition: item_sum.cc:3943
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3930
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:1994
double val_real() override
Definition: item_sum.cc:3935
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
Definition: item_sum.h:1985
Item_sum_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1983
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:1997
Definition: item_sum.h:2008
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2021
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
Definition: item_sum.h:2012
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:2026
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2024
enum Item_result result_type() const override
Definition: item_sum.h:2025
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3972
String * val_str(String *str) override
Definition: item_sum.cc:3984
Item_sum_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2010
longlong val_int() override
Definition: item_sum.cc:3976
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:3988
double val_real() override
Definition: item_sum.h:2015
Definition: item_sum.h:2033
bool resolve_type(THD *) override
Default max_length is max argument length.
Definition: item_sum.cc:3994
double val_real() override
Definition: item_sum.h:2040
String * val_str(String *) override
Definition: item_sum.cc:4010
enum Item_result result_type() const override
Definition: item_sum.h:2066
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_sum.h:2060
bool get_time(MYSQL_TIME *ltime) override
Definition: item_sum.h:2063
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:4002
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_sum.cc:4006
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
Definition: item_sum.h:2037
longlong val_int() override
Definition: item_sum.h:2049
Item_sum_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:2035
Definition: item_sum.h:1440
ulonglong count
Definition: item_sum.h:1451
void update_field() override
Definition: item_sum.cc:2764
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:2632
double val_real() override
Definition: item_sum.cc:2709
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.h:1485
void clear() override
Definition: item_sum.cc:2686
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:2652
Item * result_item(Field *) override
Definition: item_sum.h:1477
Item_sum_variance(const POS &pos, Item *item_par, uint sample_arg, PT_window *w)
Definition: item_sum.h:1461
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1470
double recurrence_s
Definition: item_sum.h:1449
bool optimize
If set, uses a algorithm II mentioned in the class description to calculate the variance which helps ...
Definition: item_sum.h:1459
const char * func_name() const override
Definition: item_sum.h:1479
bool add() override
Definition: item_sum.cc:2688
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:1478
double recurrence_s2
Definition: item_sum.h:1450
Item_result hybrid_type
Definition: item_sum.h:1444
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:2616
double recurrence_m
Used in recurrence relation.
Definition: item_sum.h:1448
my_decimal * val_decimal(my_decimal *) override
Definition: item_sum.cc:2739
uint prec_increment
Definition: item_sum.h:1453
enum Item_result result_type() const override
Definition: item_sum.h:1484
void reset_field() override
Definition: item_sum.cc:2744
uint sample
Definition: item_sum.h:1452
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:2665
Definition: item_sum.h:1923
const char * func_name() const override
Definition: item_sum.h:1931
Item * copy_or_same(THD *thd) override
Definition: item_sum.cc:3290
Item_sum_xor(const POS &pos, Item *item_par, PT_window *w)
Definition: item_sum.h:1925
Item_sum_xor(THD *thd, Item_sum_xor *item)
Definition: item_sum.h:1930
Class Item_sum is the base class used for special expressions that SQL calls 'set functions'.
Definition: item_sum.h:399
virtual void update_after_wf_arguments_changed(THD *)
Signal to the function that its arguments may have changed, and that any internal caches etc.
Definition: item_sum.h:665
bool collect_grouped_aggregates(uchar *) override
Definition: item_sum.cc:711
table_map not_null_tables() const override
Return table map of tables that can't be NULL tables (tables that are used in a context where if they...
Definition: item_sum.h:587
virtual bool check_wf_semantics1(THD *thd, Query_block *select, Window_evaluation_requirements *reqs)
Only relevant for aggregates qua window functions.
Definition: item_sum.cc:412
bool m_null_executed
true if the function is determined to be NULL at start of execution
Definition: item_sum.h:513
virtual bool check_wf_semantics2(Window_evaluation_requirements *reqs)
Like check_wf_semantics1.
Definition: item_sum.h:723
void aggregator_clear()
Called to cleanup the aggregator.
Definition: item_sum.h:677
virtual const Item_sum * unwrap_sum() const
In case we are an Item_rollup_sum_switcher, return the underlying Item_sum, otherwise,...
Definition: item_sum.h:783
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.cc:484
bool aggregate_check_distinct(uchar *arg) override
Definition: item_sum.cc:627
bool init_sum_func_check(THD *thd)
Prepare an aggregate function for checking of context.
Definition: item_sum.cc:164
virtual bool aggregator_setup(THD *thd)
Called to initialize the aggregator.
Definition: item_sum.h:671
bool wf_common_init()
Common initial actions for window functions.
Definition: item_sum.cc:923
Item_sum(const POS &pos, PT_window *w)
Definition: item_sum.h:521
bool force_copy_fields
Used in making ROLLUP.
Definition: item_sum.h:427
void no_rows_in_result() override
Mark an aggregate as having no rows.
Definition: item_sum.h:611
bool allow_group_via_temp_table
If incremental update of fields is supported.
Definition: item_sum.h:494
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_sum.h:798
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:466
void make_const()
Definition: item_sum.h:594
Item * replace_aggregate(uchar *) override
Definition: item_sum.cc:742
Window * window()
Definition: item_sum.h:733
virtual void make_unique()
Definition: item_sum.h:616
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:103
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.cc:887
bool reset_and_add()
Resets the aggregate value to its default and aggregates the current value of its attribute(s).
Definition: item_sum.h:551
bool 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:899
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_sum.h:592
virtual Item * result_item(Field *field)
Definition: item_sum.h:574
bool forced_const
True means that this field has been evaluated during optimization.
Definition: item_sum.h:508
virtual void update_field()=0
bool check_sum_func(THD *thd, Item **ref)
Validate the semantic requirements of a set function.
Definition: item_sum.cc:249
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:522
void unsupported_as_wf()
Definition: item_sum.h:792
Aggregator * aggr
Aggregator class instance.
Definition: item_sum.h:408
const Window * window() const
Definition: item_sum.h:734
virtual bool needs_partition_cardinality() const
Return true if we need to make two passes over the rows in the partition - either because we need the...
Definition: item_sum.h:763
virtual bool is_rollup_sum_wrapper() const
Overridden by Item_rollup_sum_switcher.
Definition: item_sum.h:777
bool aggregate_check_group(uchar *arg) override
Definition: item_sum.cc:651
bool with_distinct
Indicates how the aggregate function was specified by the parser : true if it was written as AGGREGAT...
Definition: item_sum.h:434
virtual enum Sumfunctype real_sum_func() const
Definition: item_sum.h:545
nesting_map save_deny_window_func
WFs are forbidden when resolving Item_sum; this member is used to restore WF allowance status afterwa...
Definition: item_sum.h:500
bool collect_scalar_subqueries(uchar *) override
Definition: item_sum.cc:750
virtual void reset_field()=0
virtual bool framing() const
All aggregates are framing, i.e.
Definition: item_sum.h:747
bool has_with_distinct() const
Definition: item_sum.h:438
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_sum.cc:770
Item * set_arg(THD *thd, uint i, Item *new_val) override
Definition: item_sum.cc:840
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:684
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:828
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:845
bool aggregator_add()
Called to add value to the aggregator.
Definition: item_sum.h:683
Item_sum(Item *a)
Definition: item_sum.h:524
void set_distinct(bool distinct)
Definition: item_sum.h:686
Item_sum * next_sum
next in the circular chain of registered objects
Definition: item_sum.h:482
Item_sum * in_sum_func
the containing set function if any
Definition: item_sum.h:483
virtual bool keep_field_type() const
Definition: item_sum.h:572
bool collect_item_field_or_view_ref_processor(uchar *) override
Collects fields and view references that have the qualifying table in the specified query block.
Definition: item_sum.cc:760
bool has_force_copy_fields() const
Definition: item_sum.h:437
Type type() const override
Definition: item_sum.h:541
void mark_as_sum_func()
Definition: item_sum.cc:456
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:136
bool reset_wf_state(uchar *arg) override
Reset execution state for such window function types as determined by arg.
Definition: item_sum.cc:910
table_map used_tables() const override
Definition: item_sum.h:584
virtual Item_sum * unwrap_sum()
Non-const version.
Definition: item_sum.h:785
void fix_after_pullout(Query_block *parent_query_block, Query_block *removed_query_block) override
Fix after tables have been moved from one query_block level to the parent level, e....
Definition: item_sum.cc:791
virtual bool setup(THD *)
Definition: item_sum.h:701
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:875
int8 max_sum_func_level
max level of aggregation for contained functions
Definition: item_sum.h:493
virtual bool uses_only_one_row() const
Only for framing window functions.
Definition: item_sum.h:753
Item ** get_arg_ptr(uint i)
Definition: item_sum.h:651
virtual enum Sumfunctype sum_func() const =0
Item_sum(const POS &pos, Item *a, Item *b, PT_window *w)
Definition: item_sum.h:532
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_sum.cc:600
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:676
Query_block * base_query_block
query block where function is placed
Definition: item_sum.h:484
Definition: item_sum.h:1939
udf_handler udf
Definition: item_sum.h:1943
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_sum.cc:3888
void update_field() override
Definition: item_sum.h:1975
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_sum.cc:3910
void reset_field() override
Definition: item_sum.h:1974
bool add() override
Definition: item_sum.cc:3903
bool fix_fields(THD *thd, Item **ref) override
Definition: item_sum.h:1960
Item_udf_sum(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_sum.h:1946
void clear() override
Definition: item_sum.cc:3897
~Item_udf_sum() override
Definition: item_sum.h:1954
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_sum.cc:3919
Item_udf_sum(THD *thd, Item_udf_sum *item)
Definition: item_sum.h:1950
Item_sum super
Definition: item_sum.h:1940
const char * func_name() const override
Definition: item_sum.h:1959
enum Sumfunctype sum_func() const override
Definition: item_sum.h:1970
Definition: item_sum.h:1358
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_sum.h:1367
const char * func_name() const override
Definition: item_sum.h:1371
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_sum.h:1370
enum Type type() const override
Definition: item_sum.h:1364
Item_variance_field(Item_sum_variance *item)
Definition: item_sum.cc:3859
uint sample
Definition: item_sum.h:1360
String * val_str(String *str) override
Definition: item_sum.h:1366
double val_real() override
Definition: item_sum.cc:3873
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:1375
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:936
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:3531
void set_nullable(bool nullable)
Definition: item.h:3640
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3538
bool get_time_from_decimal(MYSQL_TIME *ltime)
Convert val_decimal() to time in MYSQL_TIME.
Definition: item.cc:1707
void set_data_type(enum_field_types data_type)
Set the data type of the current Item.
Definition: item.h:1501
my_decimal * val_decimal_from_string(my_decimal *decimal_value)
Definition: item.cc:365
bool is_nullable() const
Definition: item.h:3639
void set_data_type_geometry()
Set the data type of the Item to be GEOMETRY.
Definition: item.h:1729
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1688
bool get_time_from_real(MYSQL_TIME *ltime)
Convert val_real() to time in MYSQL_TIME.
Definition: item.cc:1698
bool get_date_from_decimal(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_decimal() to date in MYSQL_TIME.
Definition: item.cc:1620
void set_data_type_double()
Set the data type of the Item to be double precision floating point.
Definition: item.h:1566
Item_name_string item_name
Name from query.
Definition: item.h:3539
bool fixed
True if item has been resolved.
Definition: item.h:3628
virtual Item_result result_type() const
Definition: item.h:1439
bool null_value
True if item is null.
Definition: item.h:3665
Type
Definition: item.h:971
@ SUM_FUNC_ITEM
A grouped aggregate function, or window function.
Definition: item.h:975
@ AGGR_FIELD_ITEM
A special field for certain aggregate operations.
Definition: item.h:976
bool get_date_from_numeric(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a numeric type to date.
Definition: item.cc:1648
virtual TYPELIB * get_typelib() const
Get the typelib information for an item of type set or enum.
Definition: item.h:1796
my_decimal * val_decimal_from_real(my_decimal *decimal_value)
Definition: item.cc:350
bool unsigned_flag
Definition: item.h:3666
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:1601
void set_grouping_func()
Set the property: this item is a call to GROUPING.
Definition: item.h:3447
bool get_time_from_numeric(MYSQL_TIME *ltime)
Convert a numeric type to time.
Definition: item.cc:1740
virtual bool mark_field_in_map(uchar *arg)
Mark underlying field in read or write map of a table.
Definition: item.h:2801
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:3676
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1629
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:1773
bool get_date_from_real(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_real() to date in MYSQL_TIME.
Definition: item.cc:1611
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1543
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:7628
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:1716
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:1163
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:95
Unique – class for unique (removing of duplicates).
Definition: uniques.h:53
Represents the (explicit) window of a SQL 2003 section 7.11 <window clause>, or the implicit (inlined...
Definition: window.h: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:117
bool is_initialized() const
Definition: sql_udf.h:115
bool m_original
Definition: sql_udf.h:104
bool fix_fields(THD *thd, Item_result_field *item, uint arg_count, Item **args)
Definition: item_func.cc:4560
void free_handler()
Definition: item_func.cc:4541
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:80
@ 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:4125
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:4046
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:4082
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:509
double my_strntod(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: m_ctype.h:761
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:1557
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:2878
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:423
Struct used to pass around arguments to/from check_function_as_value_generator.
Definition: item.h:492
int err_code
the error code found during check(if any)
Definition: item.h:499
const char * banned_function_name
the name of the function which is not allowed
Definition: item.h:506
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:511
argument used by walk method collect_grouped_aggregates ("cga")
Definition: item_sum.h:620
Collect_grouped_aggregate_info(Query_block *select)
Definition: item_sum.h:633
Query_block * m_query_block
The query block we walk from.
Definition: item_sum.h:628
std::vector< Item_sum * > list
accumulated all aggregates found
Definition: item_sum.h:622
std::set< Item_sum * > aggregates_that_were_hidden
Definition: item_sum.h:623
bool m_break_off
true: break off transformation
Definition: item_sum.h:630
bool m_outside
true: an aggregate aggregates outside m_query_block
Definition: item_sum.h:632
Definition: mysql_time.h:82
Bison "location" class.
Definition: parse_location.h:43
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...