MySQL 9.0.0
Source Code Documentation
Item_multi_eq Class Referencefinal

The class Item_multi_eq is used to represent conjunctions of equality predicates of the form field1 = field2, and field = const in where conditions and on join conditions. More...

#include <item_cmpfunc.h>

Inheritance diagram for Item_multi_eq:
[legend]

Classes

class  ConstFieldProxy
 
class  FieldProxy
 

Public Member Functions

 ~Item_multi_eq () override
 
 Item_multi_eq (Item_field *lhs_field, Item_field *rhs_field)
 
 Item_multi_eq (Item *const_item, Item_field *field)
 
 Item_multi_eq (Item_multi_eq *item_multi_eq)
 
 Item_multi_eq (const Item_multi_eq &)=delete
 
Item_multi_eq operator= (const Item_multi_eq &)=delete
 
 Item_multi_eq (const Item_multi_eq &&)=delete
 
Item_multi_eq operator= (const Item_multi_eq &&)=delete
 
Itemconst_arg () const
 Returns the constant Item that this multi equality is equal to(if any). More...
 
void set_const_arg (Item *const_item)
 
bool add (THD *thd, Item *const_item, Item_field *field)
 
bool add (THD *thd, Item *const_item)
 
void add (Item_field *field)
 
uint members ()
 
bool contains (const Field *field) const
 Check whether a field is referred in the multiple equality. More...
 
Item_fieldget_first ()
 Get the first field of multiple equality, use for semantic checking. More...
 
Item_fieldget_subst_item (const Item_field *field)
 Get item that can be substituted for the supplied item. More...
 
bool merge (THD *thd, Item_multi_eq *item)
 Add members of another Item_multi_eq object. More...
 
bool update_const (THD *thd)
 Check appearance of new constant items in the multiple equality object. More...
 
enum Functype functype () const override
 
longlong val_int () override
 
const char * func_name () const override
 
optimize_type select_optimize (const THD *) override
 
bool cast_incompatible_args (uchar *) override
 Wrap incompatible arguments in CAST nodes to the expected data types. More...
 
bool contains_only_equi_join_condition () const override
 Whether this Item is an equi-join condition. More...
 
template<typename Node_cmp_func >
void sort (Node_cmp_func compare)
 Order field items in multiple equality according to a sorting criteria. More...
 
FieldProxy get_fields ()
 
ConstFieldProxy get_fields () const
 
bool resolve_type (THD *) override
 Resolve type-related information for this item, such as result field type, maximum size, precision, signedness, character set and collation. More...
 
bool fix_fields (THD *thd, Item **ref) override
 
void update_used_tables () override
 Updates used tables, not null tables information and accumulates properties up the item tree, cf. More...
 
bool walk (Item_processor processor, enum_walk walk, uchar *arg) override
 Traverses a tree of Items in prefix and/or postfix order. More...
 
void print (const THD *thd, String *str, enum_query_type query_type) const override
 This method is used for to: More...
 
bool eq_specific (const Item *item) const override
 Provide a more specific equality check for a function. More...
 
const CHARSET_INFOcompare_collation () const override
 
bool equality_substitution_analyzer (uchar **) override
 
Itemequality_substitution_transformer (uchar *arg) override
 Transform an Item_multi_eq object after having added a table that represents a materialized semi-join. More...
 
float get_filtering_effect (THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
 temporary area used for constant folding More...
 
- Public Member Functions inherited from Item_bool_func
bool is_bool_func () const override
 
uint decimal_precision () const override
 
bool created_by_in2exists () const override
 Whether this Item was created by the IN->EXISTS subquery transformation. More...
 
void set_created_by_in2exists ()
 
- Public Member Functions inherited from Item_int_func
 Item_int_func ()
 
 Item_int_func (const POS &pos)
 
 Item_int_func (Item *a)
 
 Item_int_func (const POS &pos, Item *a)
 
 Item_int_func (Item *a, Item *b)
 
 Item_int_func (const POS &pos, Item *a, Item *b)
 
 Item_int_func (Item *a, Item *b, Item *c)
 
 Item_int_func (const POS &pos, Item *a, Item *b, Item *c)
 
 Item_int_func (Item *a, Item *b, Item *c, Item *d)
 
 Item_int_func (const POS &pos, Item *a, Item *b, Item *c, Item *d)
 
 Item_int_func (mem_root_deque< Item * > *list)
 
 Item_int_func (const POS &pos, PT_item_list *opt_list)
 
 Item_int_func (THD *thd, Item_int_func *item)
 
double val_real () override
 
Stringval_str (String *str) override
 
bool get_date (MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
 
bool get_time (MYSQL_TIME *ltime) override
 
enum Item_result result_type () const override
 
- Public Member Functions inherited from Item_func
virtual uint argument_count () const
 
Item ** arguments () const
 
bool reject_vector_args ()
 
uint num_vector_args ()
 
bool reject_geometry_args ()
 
bool is_null_on_null () const
 
enum Type type () const override
 
 Item_func ()
 
 Item_func (const POS &pos)
 
 Item_func (Item *a)
 
 Item_func (const POS &pos, Item *a)
 
 Item_func (Item *a, Item *b)
 
 Item_func (const POS &pos, Item *a, Item *b)
 
 Item_func (Item *a, Item *b, Item *c)
 
 Item_func (const POS &pos, Item *a, Item *b, Item *c)
 
 Item_func (Item *a, Item *b, Item *c, Item *d)
 
 Item_func (const POS &pos, Item *a, Item *b, Item *c, Item *d)
 
 Item_func (Item *a, Item *b, Item *c, Item *d, Item *e)
 
 Item_func (const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
 
 Item_func (Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
 
 Item_func (const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
 
 Item_func (mem_root_deque< Item * > *list)
 
 Item_func (const POS &pos, PT_item_list *opt_list)
 
 Item_func (THD *thd, const Item_func *item)
 
virtual Itemget_arg (uint i)
 Get the i'th argument of the function that this object represents. More...
 
virtual const Itemget_arg (uint i) const
 Get the i'th argument of the function that this object represents. More...
 
virtual Itemset_arg (THD *, uint, Item *)
 
bool do_itemize (Parse_context *pc, Item **res) override
 The core function that does the actual itemization. More...
 
bool fix_fields (THD *, Item **ref) override
 
bool fix_func_arg (THD *, Item **arg)
 
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.g by semijoin conversion. More...
 
virtual bool resolve_type_inner (THD *)
 Resolve type of function after all arguments have had their data types resolved. More...
 
bool propagate_type (THD *thd, const Type_properties &type) override
 Default implementation for all functions: Propagate base_item's type into all arguments. More...
 
virtual table_map get_initial_pseudo_tables () const
 Returns the pseudo tables depended upon in order to evaluate this function expression. More...
 
table_map used_tables () const override
 
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 would contain a NULL row generated by a LEFT or RIGHT join, the item would not be true). More...
 
void update_used_tables () override
 Updates used tables, not null tables information and accumulates properties up the item tree, cf. More...
 
void set_used_tables (table_map map)
 
bool eq (const Item *item) const override
 Compare this item with another item for equality. More...
 
virtual bool have_rev_func () const
 
virtual Itemkey_item () const
 
bool set_arguments (mem_root_deque< Item * > *list, bool context_free)
 Copy arguments from list to args array. More...
 
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() More...
 
void print (const THD *thd, String *str, enum_query_type query_type) const override
 This method is used for to: More...
 
void print_op (const THD *thd, String *str, enum_query_type query_type) const
 
void print_args (const THD *thd, String *str, uint from, enum_query_type query_type) const
 
virtual void fix_num_length_and_dec ()
 
virtual bool is_deprecated () const
 
bool get_arg0_date (MYSQL_TIME *ltime, my_time_flags_t fuzzy_date)
 
bool get_arg0_time (MYSQL_TIME *ltime)
 
bool is_null () override
 The method allows to determine nullness of a complex expression without fully evaluating it, instead of calling val*() then checking null_value. More...
 
void signal_divide_by_null ()
 
void signal_invalid_argument_for_log ()
 
Fieldtmp_table_field (TABLE *t_arg) override
 
Itemget_tmp_table_item (THD *thd) override
 If an Item is materialized in a temporary table, a different Item may have to be used in the part of the query that runs after the materialization. More...
 
my_decimalval_decimal (my_decimal *) override
 
bool agg_arg_charsets (DTCollation &c, Item **items, uint nitems, uint flags, int item_sep)
 
bool agg_arg_charsets_for_string_result (DTCollation &c, Item **items, uint nitems, int item_sep=1)
 
bool agg_arg_charsets_for_comparison (DTCollation &c, Item **items, uint nitems, int item_sep=1)
 
Itemreplace_func_call (uchar *) override
 
bool walk (Item_processor processor, enum_walk walk, uchar *arg) override
 Traverses a tree of Items in prefix and/or postfix order. More...
 
Itemtransform (Item_transformer transformer, uchar *arg) override
 Transform an Item_func object with a transformer callback function. More...
 
Itemcompile (Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t) override
 Compile Item_func object with a processor and a transformer callback functions. More...
 
void traverse_cond (Cond_traverser traverser, void *arg, traverse_order order) override
 
bool replace_equal_field_checker (uchar **arg) override
 
Itemreplace_equal_field (uchar *arg) override
 
virtual bool allow_replacement (Item_field *const original, Item *const subst)
 Check whether a function allows replacement of a field with another item: In particular, a replacement that changes the metadata of some Item from non-nullable to nullable is not allowed. More...
 
double check_float_overflow (double value)
 Throw an error if the input double number is not finite, i.e. More...
 
longlong check_integer_overflow (longlong value, bool val_unsigned)
 Throw an error if the input BIGINT value represented by the (longlong value, bool unsigned flag) pair cannot be returned by the function, i.e. More...
 
int check_decimal_overflow (int error)
 Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW. More...
 
bool has_timestamp_args ()
 
bool has_date_args ()
 
bool has_time_args ()
 
bool has_datetime_args ()
 
bool check_valid_arguments_processor (uchar *) override
 
Itemgc_subst_transformer (uchar *arg) override
 Transformer function for GC substitution. More...
 
bool resolve_type (THD *thd) override
 Resolve type-related information for this item, such as result field type, maximum size, precision, signedness, character set and collation. More...
 
virtual enum_const_item_cache can_cache_json_arg (Item *arg)
 Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion. More...
 
- Public Member Functions inherited from Item_result_field
 Item_result_field ()=default
 
 Item_result_field (const POS &pos)
 
 Item_result_field (THD *thd, const Item_result_field *item)
 
Fieldget_tmp_table_field () override
 If this Item is being materialized into a temporary table, returns the field that is being materialized into. More...
 
void set_result_field (Field *field) override
 
bool is_result_field () const override
 
Fieldget_result_field () const override
 
void cleanup () override
 Called for every Item after use (preparation and execution). More...
 
bool mark_field_in_map (uchar *arg) override
 Mark underlying field in read or write map of a table. More...
 
longlong llrint_with_overflow_check (double realval)
 
void raise_numeric_overflow (const char *type_name)
 
double raise_float_overflow ()
 
longlong raise_integer_overflow ()
 
int raise_decimal_overflow ()
 
- Public Member Functions inherited from Item
 Item (const Item &)=delete
 
void operator= (Item &)=delete
 
 Item ()
 Item constructor for general use. More...
 
 Item (THD *thd, const Item *item)
 Constructor used by Item_field, Item_ref & aggregate functions. More...
 
 Item (const POS &)
 Parse-time context-independent constructor. More...
 
 ~Item () override=default
 
virtual bool itemize (Parse_context *pc, Item **res) final
 The same as contextualize() but with additional parameter. More...
 
void rename (char *new_name)
 rename item (used for views, cleanup() return original name). More...
 
void init_make_field (Send_field *tmp_field, enum enum_field_types type)
 
virtual void notify_removal ()
 Called when an item has been removed, can be used to notify external objects about the removal, e.g subquery predicates that are part of the sj_candidates container. More...
 
virtual void make_field (Send_field *field)
 
virtual Fieldmake_string_field (TABLE *table) const
 Create a field to hold a string value from an item. More...
 
void quick_fix_field ()
 
virtual void set_can_use_prefix_key ()
 
bool propagate_type (THD *thd, enum_field_types def=MYSQL_TYPE_VARCHAR, bool pin=false, bool inherit=false)
 Wrapper for easier calling of propagate_type(const Type_properties &). More...
 
virtual void mark_json_as_scalar ()
 For Items with data type JSON, mark that a string argument is treated as a scalar JSON value. More...
 
virtual std::optional< ContainedSubqueryget_contained_subquery (const Query_block *outer_query_block)
 If this item represents a IN/ALL/ANY/comparison_operator subquery, return that (along with data on how it will be executed). More...
 
type_conversion_status save_in_field_no_warnings (Field *field, bool no_conversions)
 Save the item into a field but do not emit any warnings. More...
 
type_conversion_status save_in_field (Field *field, bool no_conversions)
 Save a temporal value in packed longlong format into a Field. More...
 
void save_in_field_no_error_check (Field *field, bool no_conversions)
 A slightly faster value of save_in_field() that returns no error value (you will need to check thd->is_error() yourself), and does not support saving into hidden fields for functional indexes. More...
 
virtual void save_org_in_field (Field *field)
 
virtual bool send (Protocol *protocol, String *str)
 This is only called from items that is not of type item_field. More...
 
bool evaluate (THD *thd, String *str)
 Evaluate scalar item, possibly using the supplied buffer. More...
 
const Itemunwrap_for_eq () const
 Unwrap an Item argument so that Item::eq() can see the "real" item, and not just the wrapper. More...
 
virtual Item_result numeric_context_result_type () const
 Result type when an item appear in a numeric context. More...
 
Item_result temporal_with_date_as_number_result_type () const
 Similar to result_type() but makes DATE, DATETIME, TIMESTAMP pretend to be numbers rather than strings. More...
 
virtual void set_data_type_inherited ()
 Set data type for item as inherited. More...
 
virtual void pin_data_type ()
 Pin the data type for the item. More...
 
enum_field_types data_type () const
 Retrieve the derived data type of the Item. More...
 
virtual enum_field_types actual_data_type () const
 Retrieve actual data type for an item. More...
 
virtual enum_field_types default_data_type () const
 Get the default data (output) type for the specific item. More...
 
void set_data_type (enum_field_types data_type)
 Set the data type of the current Item. More...
 
void set_data_type_null ()
 
void set_data_type_bool ()
 
void set_data_type_int (enum_field_types type, bool unsigned_prop, uint32 max_width)
 Set the data type of the Item to be a specific integer type. More...
 
void set_data_type_longlong ()
 Set the data type of the Item to be longlong. More...
 
void set_data_type_decimal (uint8 precision, uint8 scale)
 Set the data type of the Item to be decimal. More...
 
void set_data_type_double ()
 Set the data type of the Item to be double precision floating point. More...
 
void set_data_type_float ()
 Set the data type of the Item to be single precision floating point. More...
 
void set_data_type_string (uint32 max_l)
 Set the Item to be variable length string. More...
 
void set_data_type_string (ulonglong max_char_length_arg)
 Set the Item to be variable length string. More...
 
void set_data_type_string (uint32 max_l, const CHARSET_INFO *cs)
 Set the Item to be variable length string. More...
 
void set_data_type_string (uint32 max_l, const DTCollation &coll)
 Set the Item to be variable length string. More...
 
void set_data_type_char (uint32 max_l)
 Set the Item to be fixed length string. More...
 
void set_data_type_char (uint32 max_l, const CHARSET_INFO *cs)
 Set the Item to be fixed length string. More...
 
void set_data_type_blob (enum_field_types type, uint32 max_l)
 Set the Item to be of BLOB type. More...
 
void set_data_type_date ()
 Set all type properties for Item of DATE type. More...
 
void set_data_type_time (uint8 fsp)
 Set all type properties for Item of TIME type. More...
 
void set_data_type_datetime (uint8 fsp)
 Set all properties for Item of DATETIME type. More...
 
void set_data_type_timestamp (uint8 fsp)
 Set all properties for Item of TIMESTAMP type. More...
 
void set_data_type_vector (uint32 max_l)
 Set the data type of the Item to be VECTOR. More...
 
void set_data_type_geometry ()
 Set the data type of the Item to be GEOMETRY. More...
 
void set_data_type_json ()
 Set the data type of the Item to be JSON. More...
 
void set_data_type_year ()
 Set the data type of the Item to be YEAR. More...
 
void set_data_type_bit (uint32 max_bits)
 Set the data type of the Item to be bit. More...
 
void set_data_type_from_item (const Item *item)
 Set data type properties of the item from the properties of another item. More...
 
virtual TYPELIBget_typelib () const
 Get the typelib information for an item of type set or enum. More...
 
virtual Item_result cast_to_int_type () const
 
bool aggregate_type (const char *name, Item **items, uint count)
 Aggregates data types from array of items into current item. More...
 
virtual enum_monotonicity_info get_monotonicity_info () const
 
virtual longlong val_int_endpoint (bool left_endp, bool *incl_endp)
 
virtual longlong val_date_temporal ()
 Return date value of item in packed longlong format. More...
 
virtual longlong val_time_temporal ()
 Return time value of item in packed longlong format. More...
 
longlong val_temporal_by_field_type ()
 Return date or time value of item in packed longlong format, depending on item field type. More...
 
longlong int_sort_key ()
 Produces a key suitable for filesort. More...
 
longlong val_temporal_with_round (enum_field_types type, uint8 dec)
 Get date or time value in packed longlong format. More...
 
ulonglong val_uint ()
 
virtual Stringval_str_ascii (String *str)
 
virtual bool val_bool ()
 
virtual bool val_json (Json_wrapper *result)
 Get a JSON value from an Item. More...
 
bool error_json ()
 Get the value to return from val_json() in case of errors. More...
 
bool get_date_from_non_temporal (MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
 Convert a non-temporal type to date. More...
 
bool get_time_from_non_temporal (MYSQL_TIME *ltime)
 Convert a non-temporal type to time. More...
 
my_decimalerror_decimal (my_decimal *decimal_value)
 Get the value to return from val_decimal() in case of errors. More...
 
Stringerror_str ()
 Get the value to return from val_str() in case of errors. More...
 
type_conversion_status save_time_in_field (Field *field)
 
type_conversion_status save_date_in_field (Field *field)
 
type_conversion_status save_str_value_in_field (Field *field, String *result)
 
virtual const char * full_name () const
 
virtual bool basic_const_item () const
 Returns true if this is a simple constant item like an integer, not a constant expression. More...
 
bool may_eval_const_item (const THD *thd) const
 
virtual Itemclone_item () const
 
virtual cond_result eq_cmp_result () const
 
uint float_length (uint decimals_par) const
 
int decimal_int_part () const
 
virtual uint time_precision ()
 TIME precision of the item: 0..6. More...
 
virtual uint datetime_precision ()
 DATETIME precision of the item: 0..6. More...
 
bool const_item () const
 Returns true if item is constant, regardless of query evaluation state. More...
 
bool const_for_execution () const
 Returns true if item is constant during one query execution. More...
 
bool may_evaluate_const (const THD *thd) const
 Return true if this is a const item that may be evaluated in the current phase of statement processing. More...
 
bool is_non_deterministic () const
 
bool is_outer_reference () const
 
void print_item_w_name (const THD *thd, String *, enum_query_type query_type) const
 
void print_for_order (const THD *thd, String *str, enum_query_type query_type, const char *used_alias) const
 Prints the item when it's part of ORDER BY and GROUP BY. More...
 
bool split_sum_func2 (THD *thd, Ref_item_array ref_item_array, mem_root_deque< Item * > *fields, Item **ref, bool skip_registered)
 
virtual bool get_timeval (my_timeval *tm, int *warnings)
 Get timestamp in "struct timeval" format. More...
 
bool update_null_value ()
 Make sure the null_value member has a correct value. More...
 
virtual void apply_is_true ()
 Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the same. More...
 
virtual void no_rows_in_result ()
 
virtual Itemcopy_or_same (THD *)
 
virtual Itemcopy_andor_structure (THD *)
 
virtual Itemreal_item ()
 
virtual const Itemreal_item () const
 
virtual const CHARSET_INFOcharset_for_protocol ()
 
template<class T >
auto walk_helper_thunk (uchar *arg)
 
template<class T >
auto analyze_helper_thunk (uchar **arg)
 See CompileItem. More...
 
virtual bool intro_version (uchar *)
 
bool cleanup_processor (uchar *)
 cleanup() item if it is resolved ('fixed'). More...
 
virtual bool collect_item_field_processor (uchar *)
 
virtual bool collect_item_field_or_ref_processor (uchar *)
 
virtual bool collect_item_field_or_view_ref_processor (uchar *)
 Collects fields and view references that have the qualifying table in the specified query block. More...
 
virtual bool add_field_to_set_processor (uchar *)
 Item::walk function. More...
 
virtual bool visitor_processor (uchar *arg)
 A processor to handle the select lex visitor framework. More...
 
virtual bool add_field_to_cond_set_processor (uchar *)
 Item::walk function. More...
 
virtual bool remove_column_from_bitmap (uchar *arg)
 Visitor interface for removing all column expressions (Item_field) in this expression tree from a bitmap. More...
 
virtual bool find_item_in_field_list_processor (uchar *)
 
virtual bool change_context_processor (uchar *)
 
virtual bool find_item_processor (uchar *arg)
 
virtual bool find_field_processor (uchar *)
 Is this an Item_field which references the given Field argument? More...
 
virtual bool reset_wf_state (uchar *arg)
 Reset execution state for such window function types as determined by arg. More...
 
virtual bool used_tables_for_level (uchar *arg)
 Return used table information for the specified query block (level). More...
 
virtual bool check_column_privileges (uchar *thd)
 Check privileges. More...
 
virtual bool inform_item_in_cond_of_tab (uchar *)
 
virtual void bind_fields ()
 Bind objects from the current execution context to field objects in item trees. More...
 
virtual bool clean_up_after_removal (uchar *arg)
 Clean up after removing the item from the item tree. More...
 
virtual bool aggregate_check_distinct (uchar *)
 
virtual bool aggregate_check_group (uchar *)
 
virtual bool is_strong_side_column_not_in_fd (uchar *)
 
virtual bool is_column_not_in_fd (uchar *)
 
virtual Bool3 local_column (const Query_block *) const
 
virtual bool collect_scalar_subqueries (uchar *)
 
virtual bool collect_grouped_aggregates (uchar *)
 
virtual bool collect_subqueries (uchar *)
 
virtual bool update_depended_from (uchar *)
 
virtual bool has_aggregate_ref_in_group_by (uchar *)
 Check if an aggregate is referenced from within the GROUP BY clause of the query block in which it is aggregated. More...
 
bool visit_all_analyzer (uchar **)
 
virtual bool cache_const_expr_analyzer (uchar **cache_item)
 Check if an item is a constant one and can be cached. More...
 
Itemcache_const_expr_transformer (uchar *item)
 Cache item if needed. More...
 
virtual bool check_partition_func_processor (uchar *)
 Check if a partition function is allowed. More...
 
virtual bool subst_argument_checker (uchar **arg)
 
virtual bool explain_subquery_checker (uchar **)
 
virtual Itemexplain_subquery_propagator (uchar *)
 
virtual Itemequal_fields_propagator (uchar *)
 
virtual bool disable_constant_propagation (uchar *)
 
virtual bool check_gcol_depend_default_processor (uchar *args)
 Check if a generated expression depends on DEFAULT function with specific column name as argument. More...
 
virtual Itemreplace_with_derived_expr (uchar *arg)
 Assuming this expression is part of a condition that would be pushed to the WHERE clause of a materialized derived table, replace, in this expression, each derived table's column with a clone of the expression lying under it in the derived table's definition. More...
 
virtual Itemreplace_with_derived_expr_ref (uchar *arg)
 Assuming this expression is part of a condition that would be pushed to the HAVING clause of a materialized derived table, replace, in this expression, each derived table's column with a reference to the expression lying under it in the derived table's definition. More...
 
virtual Itemreplace_view_refs_with_clone (uchar *arg)
 Assuming this expression is part of a condition that would be pushed to a materialized derived table, replace, in this expression, each view reference with a clone of the expression in merged derived table's definition. More...
 
virtual Itemthis_item ()
 
virtual const Itemthis_item () const
 
virtual Item ** this_item_addr (THD *, Item **addr_arg)
 
virtual uint cols () const
 
virtual Itemelement_index (uint)
 
virtual Item ** addr (uint)
 
virtual bool check_cols (uint c)
 
virtual bool null_inside ()
 
virtual void bring_value ()
 
Fieldtmp_table_field_from_field_type (TABLE *table, bool fixed_length) const
 Create a field based on field_type of argument. More...
 
virtual Item_fieldfield_for_view_update ()
 
virtual Itemtruth_transformer (THD *thd, Bool_test test)
 Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implement this test by itself. More...
 
virtual Itemupdate_value_transformer (uchar *)
 
virtual Itemreplace_scalar_subquery (uchar *)
 When walking the item tree seeing an Item_singlerow_subselect matching a target, replace it with a substitute field used when transforming scalar subqueries into derived tables. More...
 
virtual Itemreplace_item_field (uchar *)
 Transform processor used by Query_block::transform_grouped_to_derived to replace fields which used to be at the transformed query block with corresponding fields in the new derived table containing the grouping operation of the original transformed query block. More...
 
virtual Itemreplace_item_view_ref (uchar *)
 
virtual Itemreplace_aggregate (uchar *)
 
virtual Itemreplace_outer_ref (uchar *)
 
virtual bool update_aggr_refs (uchar *)
 A walker processor overridden by Item_aggregate_ref, q.v. More...
 
virtual Itemsafe_charset_converter (THD *thd, const CHARSET_INFO *tocs)
 
void delete_self ()
 Delete this item. More...
 
virtual bool is_splocal () const
 
virtual Settable_routine_parameterget_settable_routine_parameter ()
 
bool is_temporal_with_date () const
 
bool is_temporal_with_date_and_time () const
 
bool is_temporal_with_time () const
 
bool is_temporal () const
 
bool has_compatible_context (Item *item) const
 Check whether this and the given item has compatible comparison context. More...
 
virtual Field::geometry_type get_geometry_type () const
 
Stringcheck_well_formed_result (String *str, bool send_error, bool truncate)
 Verifies that the input string is well-formed according to its character set. More...
 
bool eq_by_collation (Item *item, const CHARSET_INFO *cs)
 Compare two items using a given collation. More...
 
CostOfItem cost () const
 
uint32 max_char_length () const
 
uint32 max_char_length (const CHARSET_INFO *cs) const
 
void fix_char_length (uint32 max_char_length_arg)
 
virtual bool is_outer_field () const
 
bool is_blob_field () const
 Check if an item either is a blob field, or will be represented as a BLOB field if a field is created based on this item. More...
 
uint reference_count () const
 
void increment_ref_count ()
 Increment reference count. More...
 
uint decrement_ref_count ()
 Decrement reference count. More...
 
bool has_subquery () const
 
bool has_stored_program () const
 
bool has_aggregation () const
 
void set_aggregation ()
 Set the "has aggregation" property. More...
 
void reset_aggregation ()
 Reset the "has aggregation" property. More...
 
bool has_wf () const
 
void set_wf ()
 Set the "has window function" property. More...
 
bool has_grouping_set_dep () const
 
void set_group_by_modifier ()
 Set the property: this item (tree) contains a reference to a GROUP BY modifier (such as ROLLUP) More...
 
bool has_grouping_func () const
 
void set_grouping_func ()
 Set the property: this item is a call to GROUPING. More...
 
void mark_subqueries_optimized_away ()
 
virtual bool gc_subst_analyzer (uchar **)
 Analyzer function for GC substitution. More...
 
virtual bool replace_field_processor (uchar *)
 A processor that replaces any Fields with a Create_field_wrapper. More...
 
bool can_be_substituted_for_gc (bool array=false) const
 Check if this item is of a type that is eligible for GC substitution. More...
 
void aggregate_float_properties (enum_field_types type, Item **items, uint nitems)
 Set max_length and decimals of function if function is floating point and result length/precision depends on argument ones. More...
 
void aggregate_decimal_properties (Item **items, uint nitems)
 Set data type, precision and scale of item of type decimal from list of items. More...
 
uint32 aggregate_char_width (Item **items, uint nitems)
 Calculate the maximum number of characters required by any of the items. More...
 
void aggregate_temporal_properties (enum_field_types type, Item **items, uint nitems)
 Set data type and fractional seconds precision for temporal functions. More...
 
bool aggregate_string_properties (enum_field_types type, const char *name, Item **items, uint nitems)
 Aggregate string properties (character set, collation and maximum length) for string function. More...
 
void aggregate_bit_properties (Item **items, uint nitems)
 Set data type and properties of a BIT column. More...
 
virtual bool repoint_const_outer_ref (uchar *arg)
 This function applies only to Item_field objects referred to by an Item_ref object that has been marked as a const_item. More...
 
virtual bool strip_db_table_name_processor (uchar *)
 
virtual void compute_cost (CostOfItem *root_cost) const
 Compute the cost of evaluating this Item. More...
 
bool is_abandoned () const
 
bool is_nullable () const
 
void set_nullable (bool nullable)
 
virtual bool supports_partial_update (const Field_json *field) const
 Check if this expression can be used for partial update of a given JSON column. More...
 
virtual bool returns_array () const
 Whether the item returns array of its data type. More...
 
virtual void allow_array_cast ()
 A helper function to ensure proper usage of CAST(. More...
 
- Public Member Functions inherited from Parse_tree_node_tmpl< Context >
virtual ~Parse_tree_node_tmpl ()=default
 
bool is_contextualized () const
 
virtual bool contextualize (Context *pc) final
 
void error (Context *pc, const POS &pos) const
 syntax_error() function replacement for deferred reporting of syntax errors More...
 
void error (Context *pc, const POS &pos, const char *msg) const
 syntax_error() function replacement for deferred reporting of syntax errors More...
 
void errorf (Context *pc, const POS &pos, const char *format,...) const
 syntax_error() function replacement for deferred reporting of syntax errors More...
 

Public Attributes

Itemm_const_folding [2] {nullptr, nullptr}
 
- Public Attributes inherited from Item_func
uint arg_count
 How many arguments in 'args'. More...
 
- Public Attributes inherited from Item
Itemnext_free
 Intrusive list pointer for free list. More...
 
DTCollation collation
 Character set and collation properties assigned for this Item. More...
 
Item_name_string item_name
 Name from query. More...
 
Item_name_string orig_name
 Original item name (if it was renamed) More...
 
uint32 max_length
 Maximum length of result of evaluating this item, in number of bytes. More...
 
item_marker marker
 This member has several successive meanings, depending on the phase we're in (. More...
 
Item_result cmp_context
 Comparison context. More...
 
bool fixed
 True if item has been resolved. More...
 
uint8 decimals
 Number of decimals in result when evaluating this item. More...
 
bool null_value
 True if item is null. More...
 
bool unsigned_flag
 
bool m_is_window_function
 True if item represents window func. More...
 
bool hidden {false}
 If the item is in a SELECT list (Query_block::fields) and hidden is true, the item wasn't actually in the list as given by the user (it was added by the optimizer, to e.g. More...
 
bool m_in_check_constraint_exec_ctx {false}
 True if item is a top most element in the expression being evaluated for a check constraint. More...
 
- Public Attributes inherited from Parse_tree_node_tmpl< Context >
POS m_pos
 

Private Member Functions

bool compare_const (THD *thd, Item *const_item)
 Checks if the current constant value m_const_arg (that each field in fields needs to be equal to during execution) is the same as the provided constant item. More...
 
void check_covering_prefix_keys ()
 

Private Attributes

List< Item_fieldfields
 List of equal field items. More...
 
Itemm_const_arg {nullptr}
 Optional constant item equal to all the field items. More...
 
cmp_itemeval_item {nullptr}
 Helper for comparing the fields. More...
 
Arg_comparator cmp
 Helper for comparing constants. More...
 
bool m_always_false {false}
 Flag set to true if the equality is known to be always false. More...
 
bool compare_as_dates {false}
 Should constants be compared as datetimes? More...
 

Additional Inherited Members

- Public Types inherited from Item_func
enum  Functype {
  UNKNOWN_FUNC , EQ_FUNC , EQUAL_FUNC , NE_FUNC ,
  LT_FUNC , LE_FUNC , GE_FUNC , GT_FUNC ,
  FT_FUNC , MATCH_FUNC , LIKE_FUNC , ISNULL_FUNC ,
  ISNOTNULL_FUNC , ISTRUTH_FUNC , COND_AND_FUNC , COND_OR_FUNC ,
  XOR_FUNC , BETWEEN , IN_FUNC , MULTI_EQ_FUNC ,
  INTERVAL_FUNC , ISNOTNULLTEST_FUNC , SP_EQUALS_FUNC , SP_DISJOINT_FUNC ,
  SP_DISTANCE_FUNC , SP_INTERSECTS_FUNC , SP_TOUCHES_FUNC , SP_CROSSES_FUNC ,
  SP_WITHIN_FUNC , SP_CONTAINS_FUNC , SP_COVEREDBY_FUNC , SP_COVERS_FUNC ,
  SP_OVERLAPS_FUNC , SP_STARTPOINT , SP_ENDPOINT , SP_EXTERIORRING ,
  SP_POINTN , SP_GEOMETRYN , SP_INTERIORRINGN , NOT_FUNC ,
  NOT_ALL_FUNC , NOW_FUNC , FROM_DAYS_FUNC , TRIG_COND_FUNC ,
  SUSERVAR_FUNC , GUSERVAR_FUNC , COLLATE_FUNC , EXTRACT_FUNC ,
  TYPECAST_FUNC , FUNC_SP , UDF_FUNC , NEG_FUNC ,
  GSYSVAR_FUNC , GROUPING_FUNC , ROLLUP_GROUP_ITEM_FUNC , TABLE_FUNC ,
  DD_INTERNAL_FUNC , PLUS_FUNC , MINUS_FUNC , MUL_FUNC ,
  DIV_FUNC , CEILING_FUNC , ROUND_FUNC , TRUNCATE_FUNC ,
  SQRT_FUNC , ABS_FUNC , POW_FUNC , SIGN_FUNC ,
  FLOOR_FUNC , LOG_FUNC , LN_FUNC , LOG10_FUNC ,
  SIN_FUNC , TAN_FUNC , COS_FUNC , COT_FUNC ,
  DEGREES_FUNC , RADIANS_FUNC , EXP_FUNC , ASIN_FUNC ,
  ATAN_FUNC , ACOS_FUNC , MOD_FUNC , IF_FUNC ,
  NULLIF_FUNC , CASE_FUNC , YEAR_FUNC , YEARWEEK_FUNC ,
  MAKEDATE_FUNC , MAKETIME_FUNC , MONTH_FUNC , MONTHNAME_FUNC ,
  DAY_FUNC , DAYNAME_FUNC , TO_DAYS_FUNC , TO_SECONDS_FUNC ,
  DATE_FUNC , HOUR_FUNC , MINUTE_FUNC , SECOND_FUNC ,
  MICROSECOND_FUNC , DAYOFYEAR_FUNC , ADDTIME_FUNC , QUARTER_FUNC ,
  WEEK_FUNC , WEEKDAY_FUNC , DATEADD_FUNC , FROM_UNIXTIME_FUNC ,
  CONVERT_TZ_FUNC , LAST_DAY_FUNC , UNIX_TIMESTAMP_FUNC , TIME_TO_SEC_FUNC ,
  TIMESTAMPDIFF_FUNC , DATETIME_LITERAL , GREATEST_FUNC , COALESCE_FUNC ,
  LEAST_FUNC , JSON_CONTAINS , JSON_OVERLAPS , JSON_UNQUOTE_FUNC ,
  MEMBER_OF_FUNC , STRCMP_FUNC , TRUE_FUNC , FALSE_FUNC ,
  SYSDATE_FUNC , TIMEDIFF_FUNC , PERIODADD_FUNC , PERIODDIFF_FUNC ,
  SEC_TO_TIME_FUNC , GET_FORMAT_FUNC , ANY_VALUE_FUNC , JSON_LENGTH_FUNC ,
  JSON_DEPTH_FUNC , JSON_EXTRACT_FUNC , JSON_OBJECT_FUNC , JSON_ARRAY_FUNC ,
  JSON_VALID_FUNC , JSON_TYPE_FUNC , JSON_PRETTY_FUNC , JSON_QUOTE_FUNC ,
  JSON_CONTAINS_PATH_FUNC , JSON_STORAGE_SIZE_FUNC , JSON_STORAGE_FREE_FUNC , JSON_VALUE_FUNC ,
  JSON_SEARCH_FUNC
}
 
enum  optimize_type {
  OPTIMIZE_NONE , OPTIMIZE_KEY , OPTIMIZE_OP , OPTIMIZE_NULL ,
  OPTIMIZE_EQUAL
}
 
- Public Types inherited from Item
enum  Type {
  INVALID_ITEM , FIELD_ITEM , FUNC_ITEM , SUM_FUNC_ITEM ,
  AGGR_FIELD_ITEM , STRING_ITEM , INT_ITEM , DECIMAL_ITEM ,
  REAL_ITEM , NULL_ITEM , HEX_BIN_ITEM , DEFAULT_VALUE_ITEM ,
  COND_ITEM , REF_ITEM , INSERT_VALUE_ITEM , SUBQUERY_ITEM ,
  ROW_ITEM , CACHE_ITEM , TYPE_HOLDER_ITEM , PARAM_ITEM ,
  ROUTINE_FIELD_ITEM , TRIGGER_FIELD_ITEM , XPATH_NODESET_ITEM , VALUES_COLUMN_ITEM ,
  NAME_CONST_ITEM
}
 
enum  cond_result { COND_UNDEF , COND_OK , COND_TRUE , COND_FALSE }
 
enum  traverse_order { POSTFIX , PREFIX }
 
enum  enum_const_item_cache { CACHE_NONE = 0 , CACHE_JSON_VALUE , CACHE_JSON_ATOM }
 How to cache constant JSON data. More...
 
enum  Bool_test {
  BOOL_IS_TRUE = 0x00 , BOOL_IS_FALSE = 0x01 , BOOL_IS_UNKNOWN = 0x02 , BOOL_NOT_TRUE = 0x03 ,
  BOOL_NOT_FALSE = 0x04 , BOOL_NOT_UNKNOWN = 0x05 , BOOL_IDENTITY = 0x06 , BOOL_NEGATED = 0x07 ,
  BOOL_ALWAYS_TRUE = 0x08 , BOOL_ALWAYS_FALSE = 0x09
}
 < Modifier for result transformation More...
 
enum  item_marker {
  MARKER_NONE = 0 , MARKER_IMPLICIT_NE_ZERO = 1 , MARKER_CONST_PROPAG = 2 , MARKER_BIT = 4 ,
  MARKER_FUNC_DEP_NOT_NULL = 5 , MARKER_DISTINCT_GROUP = 6 , MARKER_COND_DERIVED_TABLE = 7 , MARKER_TRAVERSAL = 8 ,
  MARKER_ICP_COND_USES_INDEX_ONLY = 10
}
 < Values for member 'marker' More...
 
- Public Types inherited from Parse_tree_node_tmpl< Context >
typedef Context context_t
 
- Static Public Member Functions inherited from Item
static void * operator new (size_t size) noexcept
 
static void * operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept
 
static void operator delete (void *ptr, size_t size)
 
static void operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept
 
static enum_field_types result_to_type (Item_result result)
 
static Item_result type_to_result (enum_field_types type)
 
static enum_field_types type_for_variable (enum_field_types src_type)
 Provide data type for a user or system variable, based on the type of the item that is assigned to the variable. More...
 
static enum_field_types string_field_type (uint32 max_bytes)
 Determine correct string field type, based on string length. More...
 
static const CHARSET_INFOdefault_charset ()
 
- Static Public Member Functions inherited from Parse_tree_node_tmpl< Context >
static void * operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept
 
static void operator delete (void *ptr, size_t size)
 
static void operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept
 
- Static Public Attributes inherited from Item_bool_func
static const char * bool_transform_names [10]
 
static const Bool_test bool_transform [10][8]
 Array that transforms a boolean test according to another. More...
 
- Protected Member Functions inherited from Item_bool_func
 Item_bool_func ()
 
 Item_bool_func (const POS &pos)
 
 Item_bool_func (Item *a)
 
 Item_bool_func (const POS &pos, Item *a)
 
 Item_bool_func (Item *a, Item *b, Item *c)
 
 Item_bool_func (Item *a, Item *b)
 
 Item_bool_func (const POS &pos, Item *a, Item *b)
 
 Item_bool_func (const POS &pos, Item *a, Item *b, Item *c)
 
 Item_bool_func (THD *thd, Item_bool_func *item)
 
- Protected Member Functions inherited from Item_func
bool param_type_uses_non_param (THD *thd, enum_field_types def=MYSQL_TYPE_VARCHAR)
 
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,...,end[ : if they're a PS parameter with invalid (not known) type, give them default type "def". More...
 
bool param_type_is_default (THD *thd, uint start, uint end, enum_field_types def=MYSQL_TYPE_VARCHAR)
 
bool param_type_is_rejected (uint start, uint end)
 For arguments of this Item_func ("args" array), in range [start,end[ : sends error if they're a dynamic parameter. More...
 
const Item_fieldcontributes_to_filter (THD *thd, table_map read_tables, table_map filter_for_table, const MY_BITMAP *fields_to_ignore) const
 Whether or not an item should contribute to the filtering effect (. More...
 
virtual bool may_have_named_parameters () const
 Named parameters are allowed in a parameter list. More...
 
bool is_non_const_over_literals (uchar *) override
 
bool check_function_as_value_generator (uchar *checker_args) override
 Check if this item is allowed for a virtual column or inside a default expression. More...
 
bool is_valid_for_pushdown (uchar *arg) override
 Check if all the columns present in this expression are from the derived table. More...
 
bool check_column_in_window_functions (uchar *arg) override
 Check if all the columns present in this expression are present in PARTITION clause of window functions of the derived table. More...
 
bool check_column_in_group_by (uchar *arg) override
 Check if all the columns present in this expression are present in GROUP BY clause of the derived table. More...
 
longlong val_int_from_real ()
 
- Protected Member Functions inherited from Item
Stringmake_empty_result ()
 Sets the result value of the function an empty string, using the current character set. More...
 
bool skip_itemize (Item **res)
 Helper function to skip itemize() for grammar-allocated items. More...
 
virtual type_conversion_status save_in_field_inner (Field *field, bool no_conversions)
 Helper function which does all of the work for save_in_field(Field*, bool), except some error checking common to all subclasses, which is performed by save_in_field() itself. More...
 
Stringval_string_from_real (String *str)
 
Stringval_string_from_int (String *str)
 
Stringval_string_from_decimal (String *str)
 
Stringval_string_from_date (String *str)
 
Stringval_string_from_datetime (String *str)
 
Stringval_string_from_time (String *str)
 
my_decimalval_decimal_from_real (my_decimal *decimal_value)
 
my_decimalval_decimal_from_int (my_decimal *decimal_value)
 
my_decimalval_decimal_from_string (my_decimal *decimal_value)
 
my_decimalval_decimal_from_date (my_decimal *decimal_value)
 
my_decimalval_decimal_from_time (my_decimal *decimal_value)
 
longlong val_int_from_decimal ()
 
longlong val_int_from_date ()
 
longlong val_int_from_time ()
 
longlong val_int_from_datetime ()
 
longlong val_int_from_string ()
 
double val_real_from_decimal ()
 
double val_real_from_string ()
 
bool error_bool ()
 Get the value to return from val_bool() in case of errors. More...
 
int error_int ()
 Get the value to return from val_int() in case of errors. More...
 
double error_real ()
 Get the value to return from val_real() in case of errors. More...
 
bool error_date ()
 Get the value to return from get_date() in case of errors. More...
 
bool error_time ()
 Get the value to return from get_time() in case of errors. More...
 
Stringnull_return_str ()
 Gets the value to return from val_str() when returning a NULL value. More...
 
bool get_date_from_string (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_str() to date in MYSQL_TIME. More...
 
bool get_date_from_real (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_real() to date in MYSQL_TIME. More...
 
bool get_date_from_decimal (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_decimal() to date in MYSQL_TIME. More...
 
bool get_date_from_int (MYSQL_TIME *ltime, my_time_flags_t flags)
 Convert val_int() to date in MYSQL_TIME. More...
 
bool get_date_from_time (MYSQL_TIME *ltime)
 Convert get_time() from time to date in MYSQL_TIME. More...
 
bool get_date_from_numeric (MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
 Convert a numeric type to date. More...
 
bool get_time_from_string (MYSQL_TIME *ltime)
 Convert val_str() to time in MYSQL_TIME. More...
 
bool get_time_from_real (MYSQL_TIME *ltime)
 Convert val_real() to time in MYSQL_TIME. More...
 
bool get_time_from_decimal (MYSQL_TIME *ltime)
 Convert val_decimal() to time in MYSQL_TIME. More...
 
bool get_time_from_int (MYSQL_TIME *ltime)
 Convert val_int() to time in MYSQL_TIME. More...
 
bool get_time_from_date (MYSQL_TIME *ltime)
 Convert date to time. More...
 
bool get_time_from_datetime (MYSQL_TIME *ltime)
 Convert datetime to time. More...
 
bool get_time_from_numeric (MYSQL_TIME *ltime)
 Convert a numeric type to time. More...
 
virtual longlong val_date_temporal_at_utc ()
 
virtual longlong val_time_temporal_at_utc ()
 
void set_accum_properties (const Item *item)
 Set accumulated properties for an Item. More...
 
void add_accum_properties (const Item *item)
 Add more accumulated properties to an Item. More...
 
void set_subquery ()
 Set the "has subquery" property. More...
 
void set_stored_program ()
 Set the "has stored program" property. More...
 
- Protected Member Functions inherited from Parse_tree_node_tmpl< Context >
 Parse_tree_node_tmpl ()=delete
 
 Parse_tree_node_tmpl (const POS &pos)
 
 Parse_tree_node_tmpl (const POS &start_pos, const POS &end_pos)
 
bool begin_parse_tree (Show_parse_tree *tree)
 
bool end_parse_tree (Show_parse_tree *tree)
 
virtual bool do_contextualize (Context *pc)
 Do all context-sensitive things and mark the node as contextualized. More...
 
virtual void add_json_info (Json_object *json_obj)
 Add all the node-specific json fields. More...
 
- Static Protected Member Functions inherited from Item
static bool bit_func_returns_binary (const Item *a, const Item *b)
 
static bool mark_field_in_map (Mark_field *mark_field, Field *field)
 Helper function for mark_field_in_map(uchar *arg). More...
 
- Protected Attributes inherited from Item_func
Item ** args
 Array of pointers to arguments. More...
 
bool null_on_null {true}
 Affects how to determine that NULL argument implies a NULL function return. More...
 
uint allowed_arg_cols {1}
 
table_map used_tables_cache {0}
 Value used in calculation of result of used_tables() More...
 
table_map not_null_tables_cache {0}
 Value used in calculation of result of not_null_tables() More...
 
- Protected Attributes inherited from Item_result_field
Fieldresult_field {nullptr}
 
- Protected Attributes inherited from Item
String str_value
 str_values's main purpose is to cache the value in save_in_field More...
 
uint8 m_accum_properties
 
- Static Protected Attributes inherited from Item
static constexpr uint8 PROP_SUBQUERY = 0x01
 Set of properties that are calculated by accumulation from underlying items. More...
 
static constexpr uint8 PROP_STORED_PROGRAM = 0x02
 
static constexpr uint8 PROP_AGGREGATION = 0x04
 
static constexpr uint8 PROP_WINDOW_FUNCTION = 0x08
 
static constexpr uint8 PROP_HAS_GROUPING_SET_DEP = 0x10
 Set if the item or one or more of the underlying items contains a GROUP BY modifier (such as ROLLUP). More...
 
static constexpr uint8 PROP_GROUPING_FUNC = 0x20
 Set if the item or one or more of the underlying items is a GROUPING function. More...
 

Detailed Description

The class Item_multi_eq is used to represent conjunctions of equality predicates of the form field1 = field2, and field = const in where conditions and on join conditions.

All equality predicates of the form field1=field2 contained in a conjunction are substituted for a sequence of items of this class. An item of this class Item_multi_eq(f1,f2,...fk) represents a multiple equality f1=f2=...=fk.

If a conjunction contains predicates f1=f2 and f2=f3, a new item of this class is created Item_multi_eq(f1,f2,f3) representing the multiple equality f1=f2=f3 that substitutes the above equality predicates in the conjunction. A conjunction of the predicates f2=f1 and f3=f1 and f3=f2 will be substituted for the item representing the same multiple equality f1=f2=f3. An item Item_multi_eq(f1,f2) can appear instead of a conjunction of f2=f1 and f1=f2, or instead of just the predicate f1=f2.

An item of the class Item_multi_eq inherits equalities from outer conjunctive levels.

Suppose we have a where condition of the following form: WHERE f1=f2 AND f3=f4 AND f3=f5 AND ... AND (...OR (f1=f3 AND ...)). In this case: f1=f2 will be substituted for Item_multi_eq(f1,f2); f3=f4 and f3=f5 will be substituted for Item_multi_eq(f3,f4,f5); f1=f3 will be substituted for Item_multi_eq(f1,f2,f3,f4,f5);

An object of the class Item_multi_eq can contain an optional constant item c. Then it represents a multiple equality of the form c=f1=...=fk.

Objects of the class Item_multi_eq are used for the following:

  1. An object Item_multi_eq(t1.f1,...,tk.fk) allows us to consider any pair of tables ti and tj as joined by an equi-condition. Thus it provide us with additional access paths from table to table.
  2. An object Item_multi_eq(t1.f1,...,tk.fk) is applied to deduce new SARGable predicates: f1=...=fk AND P(fi) => f1=...=fk AND P(fi) AND P(fj). It also can give us additional index scans and can allow us to improve selectivity estimates.
  3. An object Item_multi_eq(t1.f1,...,tk.fk) is used to optimize the selected execution plan for the query: if table ti is accessed before the table tj then in any predicate P in the where condition the occurrence of tj.fj is substituted for ti.fi. This can allow an evaluation of the predicate at an earlier step.

When feature 1 is supported they say that join transitive closure is employed. When feature 2 is supported they say that search argument transitive closure is employed. Both features are usually supported by preprocessing original query and adding additional predicates. We do not just add predicates, we rather dynamically replace some predicates that can not be used to access tables in the investigated plan for those, obtained by substitution of some fields for equal fields, that can be used.

Multiple equality objects are employed only at the optimize phase. Usually they are not supposed to be evaluated. Yet in some cases we call the method val_int() for them. We have to take care of restricting the predicate such an object represents f1=f2= ...=fn to the projection of known fields fi1=...=fik.

Constructor & Destructor Documentation

◆ ~Item_multi_eq()

Item_multi_eq::~Item_multi_eq ( )
override

◆ Item_multi_eq() [1/5]

Item_multi_eq::Item_multi_eq ( Item_field lhs_field,
Item_field rhs_field 
)

◆ Item_multi_eq() [2/5]

Item_multi_eq::Item_multi_eq ( Item const_item,
Item_field field 
)

◆ Item_multi_eq() [3/5]

Item_multi_eq::Item_multi_eq ( Item_multi_eq item_multi_eq)
explicit

◆ Item_multi_eq() [4/5]

Item_multi_eq::Item_multi_eq ( const Item_multi_eq )
delete

◆ Item_multi_eq() [5/5]

Item_multi_eq::Item_multi_eq ( const Item_multi_eq &&  )
delete

Member Function Documentation

◆ add() [1/3]

void Item_multi_eq::add ( Item_field field)

◆ add() [2/3]

bool Item_multi_eq::add ( THD thd,
Item const_item 
)

◆ add() [3/3]

bool Item_multi_eq::add ( THD thd,
Item const_item,
Item_field field 
)

◆ cast_incompatible_args()

bool Item_multi_eq::cast_incompatible_args ( uchar )
inlineoverridevirtual

Wrap incompatible arguments in CAST nodes to the expected data types.

Reimplemented from Item.

◆ check_covering_prefix_keys()

void Item_multi_eq::check_covering_prefix_keys ( )
private

◆ compare_collation()

const CHARSET_INFO * Item_multi_eq::compare_collation ( ) const
inlineoverridevirtual

Reimplemented from Item.

◆ compare_const()

bool Item_multi_eq::compare_const ( THD thd,
Item const_item 
)
private

Checks if the current constant value m_const_arg (that each field in fields needs to be equal to during execution) is the same as the provided constant item.

If that's not the case, it sets m_always_false to true as a field cannot be equal to different constant values at the same time.

Returns
false on success, true on error.

◆ const_arg()

Item * Item_multi_eq::const_arg ( ) const
inline

Returns the constant Item that this multi equality is equal to(if any).

◆ contains()

bool Item_multi_eq::contains ( const Field field) const

Check whether a field is referred in the multiple equality.

The function checks whether field is occurred in the Item_multi_eq object .

Parameters
fieldfield whose occurrence is to be checked
Returns
true if multiple equality contains a reference to field, false otherwise.

◆ contains_only_equi_join_condition()

bool Item_multi_eq::contains_only_equi_join_condition ( ) const
inlineoverridevirtual

Whether this Item is an equi-join condition.

If this Item is a compound item (i.e. multiple condition AND'ed together), it will only return true if the Item contains only equi-join conditions AND'ed together. This is used to determine whether the condition can be used as a join condition for hash join (join conditions in hash join must be equi-join conditions), or if it should be placed as a filter after the join.

Reimplemented from Item_func.

◆ eq_specific()

bool Item_multi_eq::eq_specific ( const Item ) const
overridevirtual

Provide a more specific equality check for a function.

Combine with Item::eq() to implement a complete equality check.

Reimplemented from Item_func.

◆ equality_substitution_analyzer()

bool Item_multi_eq::equality_substitution_analyzer ( uchar **  )
inlineoverridevirtual

Reimplemented from Item.

◆ equality_substitution_transformer()

Item * Item_multi_eq::equality_substitution_transformer ( uchar arg)
overridevirtual

Transform an Item_multi_eq object after having added a table that represents a materialized semi-join.

If the multiple equality represented by the Item_multi_eq object contains a field from the subquery that was used to create the materialized table, add the corresponding key field from the materialized table to the multiple equality.

See also
JOIN::update_equalities_for_sjm() for the reason.

Reimplemented from Item.

◆ fix_fields()

bool Item_multi_eq::fix_fields ( THD thd,
Item **  ref 
)
overridevirtual

Reimplemented from Item.

◆ func_name()

const char * Item_multi_eq::func_name ( ) const
inlineoverridevirtual

Implements Item_func.

◆ functype()

enum Functype Item_multi_eq::functype ( ) const
inlineoverridevirtual

Reimplemented from Item_func.

◆ get_fields() [1/2]

FieldProxy Item_multi_eq::get_fields ( )
inline

◆ get_fields() [2/2]

ConstFieldProxy Item_multi_eq::get_fields ( ) const
inline

◆ get_filtering_effect()

float Item_multi_eq::get_filtering_effect ( THD thd,
table_map  filter_for_table,
table_map  read_tables,
const MY_BITMAP fields_to_ignore,
double  rows_in_table 
)
overridevirtual

temporary area used for constant folding

Get filtering effect for multiple equalities, i.e.

"tx.col = value_1 = ... = value_n" where value_i may be a constant, a column etc.

The multiple equality only contributes to the filtering effect for 'filter_for_table' if a) A column in 'filter_for_table' is referred to b) at least one value_i is a constant or a column in a table already read

If this multiple equality refers to more than one column in 'filter_for_table', the predicates on all these fields will contribute to the filtering effect.

Reimplemented from Item.

◆ get_first()

Item_field * Item_multi_eq::get_first ( )
inline

Get the first field of multiple equality, use for semantic checking.

Return values
Firstfield in the multiple equality.

◆ get_subst_item()

Item_field * Item_multi_eq::get_subst_item ( const Item_field field)

Get item that can be substituted for the supplied item.

Parameters
fieldfield item to get substitution field for, which must be present within the multiple equality itself.
Return values
Foundsubstitution item in the multiple equality.

Get the first item of multiple equality that can be substituted for the given field item. In order to make semijoin materialization strategy work correctly we can't propagate equal fields between a materialized semijoin and the outer query (or any other semijoin) unconditionally. Thus the field is returned according to the following rules:

1) If the given field belongs to a materialized semijoin then the first field in the multiple equality which belongs to the same semijoin is returned. 2) If the given field doesn't belong to a materialized semijoin then the first field in the multiple equality is returned.

◆ members()

uint Item_multi_eq::members ( )

◆ merge()

bool Item_multi_eq::merge ( THD thd,
Item_multi_eq item 
)

Add members of another Item_multi_eq object.

The function merges two multiple equalities. After this operation the Item_multi_eq object additionally contains the field items of another item of the type Item_multi_eq. If the optional constant items are not equal the m_always_false flag is set to true.

Parameters
thdthread handler
itemmultiple equality whose members are to be joined
Returns
false if success, true if error

◆ operator=() [1/2]

Item_multi_eq Item_multi_eq::operator= ( const Item_multi_eq &&  )
delete

◆ operator=() [2/2]

Item_multi_eq Item_multi_eq::operator= ( const Item_multi_eq )
delete

◆ print()

void Item_multi_eq::print ( const THD ,
String str,
enum_query_type   
) const
overridevirtual

This method is used for to:

  • to generate a view definition query (SELECT-statement);
  • to generate a SQL-query for EXPLAIN EXTENDED;
  • to generate a SQL-query to be shown in INFORMATION_SCHEMA;
  • to generate a SQL-query that looks like a prepared statement for query_rewrite
  • debug.

For more information about view definition query, INFORMATION_SCHEMA query and why they should be generated from the Item-tree,

See also
mysql_register_view().

Reimplemented from Item.

◆ resolve_type()

bool Item_multi_eq::resolve_type ( THD thd)
overridevirtual

Resolve type-related information for this item, such as result field type, maximum size, precision, signedness, character set and collation.

Also check compatibility of argument types and return error when applicable. Also adjust nullability when applicable.

Parameters
thdthread handler
Returns
false if success, true if error

Reimplemented from Item_bool_func.

◆ select_optimize()

optimize_type Item_multi_eq::select_optimize ( const THD )
inlineoverridevirtual

Reimplemented from Item_func.

◆ set_const_arg()

void Item_multi_eq::set_const_arg ( Item const_item)
inline

◆ sort()

template<typename Node_cmp_func >
void Item_multi_eq::sort ( Node_cmp_func  compare)
inline

Order field items in multiple equality according to a sorting criteria.

The function perform ordering of the field items in the Item_multi_eq object according to the criteria determined by the cmp callback parameter. If cmp(item_field1,item_field2,arg)<0 than item_field1 must be placed after item_field2.

The function sorts field items by the exchange sort algorithm. The list of field items is looked through and whenever two neighboring members follow in a wrong order they are swapped. This is performed again and again until we get all members in a right order.

Parameters
comparefunction to compare field item

◆ update_const()

bool Item_multi_eq::update_const ( THD thd)

Check appearance of new constant items in the multiple equality object.

The function checks appearance of new constant items among the members of multiple equalities. Each new constant item is compared with the designated constant item if there is any in the multiple equality. If there is none the first new constant item becomes designated.

Parameters
thdthread handler
Returns
false if success, true if error

◆ update_used_tables()

void Item_multi_eq::update_used_tables ( )
overridevirtual

Updates used tables, not null tables information and accumulates properties up the item tree, cf.

used_tables_cache, not_null_tables_cache and m_accum_properties.

TODO(sgunders): Consider just removing these caches; it causes a lot of bugs (cache invalidation is known to be a complex problem), and the performance benefits are dubious.

Reimplemented from Item.

◆ val_int()

longlong Item_multi_eq::val_int ( void  )
overridevirtual

Implements Item.

◆ walk()

bool Item_multi_eq::walk ( Item_processor  processor,
enum_walk  walk,
uchar arg 
)
overridevirtual

Traverses a tree of Items in prefix and/or postfix order.

Optionally walks into subqueries.

Parameters
processorprocessor function to be invoked per item returns true to abort traversal, false to continue
walkcontrols how to traverse the item tree enum_walk::PREFIX: call processor before invoking children enum_walk::POSTFIX: call processor after invoking children enum_walk::SUBQUERY go down into subqueries walk values are bit-coded and may be combined. Omitting both enum_walk::PREFIX and enum_walk::POSTFIX is undefined behaviour.
argOptional pointer to a walk-specific object
Return values
falsewalk succeeded
truewalk aborted by agreement, an error may have been reported

Reimplemented from Item.

Member Data Documentation

◆ cmp

Arg_comparator Item_multi_eq::cmp
private

Helper for comparing constants.

◆ compare_as_dates

bool Item_multi_eq::compare_as_dates {false}
private

Should constants be compared as datetimes?

◆ eval_item

cmp_item* Item_multi_eq::eval_item {nullptr}
private

Helper for comparing the fields.

◆ fields

List<Item_field> Item_multi_eq::fields
private

List of equal field items.

◆ m_always_false

bool Item_multi_eq::m_always_false {false}
private

Flag set to true if the equality is known to be always false.

◆ m_const_arg

Item* Item_multi_eq::m_const_arg {nullptr}
private

Optional constant item equal to all the field items.

◆ m_const_folding

Item* Item_multi_eq::m_const_folding[2] {nullptr, nullptr}

The documentation for this class was generated from the following files: