1#ifndef ITEM_SUBSELECT_INCLUDED
2#define ITEM_SUBSELECT_INCLUDED
190 pointer_cast<Check_function_as_value_generator_parameters *>(args);
198 std::vector<Item_subselect *>
list;
202 for (
auto sq :
list) {
203 if (sq->m_query_expr == candidate)
return true;
280 bool possibly_empty);
284 void reset()
override;
304 uint
cols()
const override;
638 return m_in2exists_info !=
nullptr && m_in2exists_info->added_to_where;
643 return m_in2exists_info->dependent_before;
724 } *m_in2exists_info{
nullptr};
866 in_predicate,
nullptr,
nullptr),
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Abstract factory interface for creating comparison predicates.
Definition: item_cmpfunc.h:525
Class that represents a quantified comparison predicate.
Definition: item_subselect.h:740
Item_allany_subselect(Item *left_expr, chooser_compare_func_creator fc, Query_block *select, bool all)
Definition: item_subselect.cc:1452
bool transformer(THD *thd, Item **transformed) override
Definition: item_subselect.cc:2918
bool m_all
Definition: item_subselect.h:754
Subquery_type subquery_type() const override
Definition: item_subselect.h:745
Comp_creator * m_func
Definition: item_subselect.h:753
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_subselect.cc:2928
chooser_compare_func_creator m_func_creator
Definition: item_subselect.h:752
Definition: item_subselect.h:428
enum_condition_context outer_condition_context
Used by the transformation to derived table.
Definition: item_subselect.h:453
bool is_semijoin_candidate(THD *thd)
Definition: item_subselect.cc:1508
void apply_is_true() override
Apply the IS TRUE truth property, meaning that an UNKNOWN result and a FALSE result are treated the s...
Definition: item_subselect.h:517
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_subselect.cc:1469
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_subselect.h:532
String * val_str(String *) override
Return the result of EXISTS as a string value.
Definition: item_subselect.cc:1717
bool m_value
value of this item (boolean: exists/not-exists)
Definition: item_subselect.h:547
Item_exists_subselect()
Definition: item_subselect.h:441
double val_real() override
Definition: item_subselect.cc:1703
bool get_time(MYSQL_TIME *ltime) override
Definition: item_subselect.h:535
bool implicit_is_op
True if the IS TRUE/FALSE wasn't explicit in the query.
Definition: item_subselect.h:514
Item * truth_transformer(THD *, enum Bool_test test) override
Informs an item that it is wrapped in a truth test, in case it wants to transforms itself to implemen...
Definition: item_subselect.cc:1380
longlong val_int() override
Definition: item_subselect.cc:1705
Subquery_strategy strategy
Execution strategy chosen for this Item.
Definition: item_subselect.h:451
Item * left_expr
Definition: item_subselect.h:446
bool val_bool() override
Definition: item_subselect.cc:1741
int sj_convert_priority
Priority of this predicate in the convert-to-semi-join-nest process.
Definition: item_subselect.h:449
void reset() override
Reset state after a single execution of a subquery, useful when a dependent subquery must be evaluate...
Definition: item_subselect.h:491
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_subselect.cc:1322
bool abort_on_null
True if naked IN is allowed to exchange FALSE for UNKNOWN.
Definition: item_subselect.h:554
virtual bool transformer(THD *thd, Item **transformed)
Definition: item_subselect.cc:1491
bool is_derived_candidate(THD *thd)
Definition: item_subselect.cc:1599
bool can_do_aj
True if the Item has decided that it can do antijoin.
Definition: item_subselect.h:524
bool with_is_op() const
Definition: item_subselect.h:502
bool fix_fields(THD *thd, Item **ref) override
An object of class Item_in_subselect is always substituted with another object of class Item_in_optim...
Definition: item_subselect.cc:2657
enum Bool_test value_transform
Definition: item_subselect.h:501
void notify_removal() override
Called when an item has been removed, can be used to notify external objects about the removal,...
Definition: item_subselect.h:472
Subquery_type subquery_type() const override
Definition: item_subselect.h:489
Item_subselect super
Definition: item_subselect.h:429
bool translate(bool &null_v, bool v)
Translates the value of the naked EXISTS to a value taking into account the optional NULL and IS [NOT...
Definition: item_subselect.cc:1343
bool is_bool_func() const override
Definition: item_subselect.h:490
Table_ref * embedding_join_nest
Used by subquery optimizations to keep track about where this subquery predicate is located,...
Definition: item_subselect.h:470
bool choose_semijoin_or_antijoin()
Helper for is_semijoin_candidate() and is_derived_candidate().
Definition: item_subselect.cc:1666
Item_exists_subselect(const POS &pos)
Definition: item_subselect.h:443
my_decimal * val_decimal(my_decimal *) override
Return the result of EXISTS as a decimal value.
Definition: item_subselect.cc:1734
enum Item_result result_type() const override
Definition: item_subselect.h:496
Definition: item_cmpfunc.h:920
Definition: item_cmpfunc.h:492
Representation of IN subquery predicates of the form "left_expr IN (SELECT ...)".
Definition: item_subselect.h:572
void fix_after_pullout(Query_block *parent_query_block, Query_block *removed_query_block) override
Definition: item_subselect.cc:2727
my_decimal * val_decimal(my_decimal *) override
Return the result of EXISTS as a decimal value.
Definition: item_subselect.cc:1794
Item * compile(Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t) override
Perform a generic "compilation" of the Item tree, ie transform the Item tree by adding zero or more I...
Definition: item_subselect.cc:770
double val_real() override
Definition: item_subselect.cc:1752
struct Item_in_subselect::In2exists_info nullptr
bool m_left_expr_cache_filled
Whether m_left_expr_cache holds a value.
Definition: item_subselect.h:673
bool single_value_transformer(THD *thd, Comp_creator *func, Item **transformed)
Transform a single-column IN/ALL/ANY subquery predicate.
Definition: item_subselect.cc:1830
void set_cond_guard_var(int i, bool v) const
Definition: item_subselect.h:649
bool row_value_transformer(THD *thd, Item **transformed)
Transform a multi-column IN/ALL/ANY subquery predicate.
Definition: item_subselect.cc:2259
std::optional< ContainedSubquery > get_contained_subquery(const Query_block *outer_query_block) override
If this item represents a IN/ALL/ANY/comparison_operator subquery, return that (along with data on ho...
Definition: item_subselect.cc:2785
Item_func_not_all * m_upper_item
Point on NOT/NOP before ALL/SOME subquery.
Definition: item_subselect.h:663
bool need_expr_cache
The need for expr cache may be optimized away,.
Definition: item_subselect.h:676
bool finalize_materialization_transform(THD *thd, JOIN *join)
Once the decision to use materialization has been taken, performs some last steps of this transformat...
Definition: item_subselect.cc:481
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_subselect.cc:1439
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_subselect.cc:2615
void reset() override
Reset state after a single execution of a subquery, useful when a dependent subquery must be evaluate...
Definition: item_subselect.h:587
List< Cached_item > * m_left_expr_cache
Cache of the left operand of the subquery predicate.
Definition: item_subselect.h:670
bool mark_as_outer(Item *left_row, size_t col)
Decide whether to mark the injected left expression "outer" relative to the subquery.
Definition: item_subselect.cc:433
Item * transform(Item_transformer transformer, uchar *arg) override
Perform a generic transformation of the Item tree, by adding zero or more additional Item objects to ...
Definition: item_subselect.cc:763
bool * m_pushed_cond_guards
Used to trigger on/off conditions that were pushed down to subquery.
Definition: item_subselect.h:660
bool dependent_before_in2exists() const
Is reliable only if IN->EXISTS has been done.
Definition: item_subselect.h:642
AccessPath * root_access_path() const override
Definition: item_subselect.cc:572
PT_subquery * pt_subselect
Definition: item_subselect.h:726
longlong val_int() override
Definition: item_subselect.cc:1759
bool * get_cond_guard(int i) const
Definition: item_subselect.h:646
bool row_value_in_to_exists_transformer(THD *thd, Query_block *select, Item_in_optimizer *optimizer)
Transform a (possibly non-correlated) IN subquery into a correlated EXISTS.
Definition: item_subselect.cc:2324
bool finalize_exists_transform(THD *thd, Query_block *select)
Once the decision to use IN->EXISTS has been taken, performs some last steps of this transformation.
Definition: item_subselect.cc:440
bool val_bool() override
Definition: item_subselect.cc:1773
bool m_was_null
Definition: item_subselect.h:701
bool init_left_expr_cache(THD *thd)
Initialize the cache of the left operand of the IN predicate.
Definition: item_subselect.cc:2752
bool quantified_comp_transformer(THD *thd, Comp_creator *func, Item **transformed)
Perform transformation of quantified comparison predicates (ie.
Definition: item_subselect.cc:2534
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_subselect.cc:540
String * val_str(String *) override
Return the result of EXISTS as a string value.
Definition: item_subselect.cc:1766
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_subselect.cc:2734
bool in2exists_added_to_where() const
Definition: item_subselect.h:637
bool walk(Item_processor processor, enum_walk walk, uchar *arg) override
Traverses a tree of Items in prefix and/or postfix order.
Definition: item_subselect.cc:757
Item_exists_subselect super
Definition: item_subselect.h:573
Subquery_type subquery_type() const override
Definition: item_subselect.h:585
bool single_value_in_to_exists_transformer(THD *thd, Query_block *select, Comp_creator *func)
Transform an IN predicate into EXISTS via predicate injection.
Definition: item_subselect.cc:2051
bool test_limit()
Definition: item_subselect.cc:1411
Item_in_subselect()
Definition: item_subselect.h:580
bool val_bool_naked()
Definition: item_subselect.cc:1780
Item_ref * m_injected_left_expr
In the case of.
Definition: item_subselect.h:699
bool exec(THD *thd) override
Definition: item_subselect.cc:786
bool transformer(THD *thd, Item **transformed) override
Definition: item_subselect.cc:2518
Definition: item_cmpfunc.h:2318
Definition: item_subselect.h:372
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_subselect.cc:1110
bool m_has_values
Set if we have found at least one row.
Definition: item_subselect.h:394
bool is_maxmin() const override
Definition: item_subselect.h:390
bool m_max
True if performing MAX, false if MIN.
Definition: item_subselect.h:393
void reset_has_values() override
Used by max/min subquery to initialize value presence registration mechanism.
Definition: item_subselect.h:389
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_subselect.cc:1103
bool has_values() const
Definition: item_subselect.h:387
void register_value()
Definition: item_subselect.h:388
Item_maxmin_subselect(Item_subselect *parent, Query_block *query_block, bool max_arg)
Create an Item for use in transformation of quantified comparison predicates that can be evaluated us...
Definition: item_subselect.cc:1087
Item with result field.
Definition: item.h:5811
Class that represents scalar subquery and row subquery.
Definition: item_subselect.h:271
Item * replace_scalar_subquery(uchar *arge) override
When walking the item tree seeing an Item_singlerow_subselect matching a target, replace it with a su...
Definition: item_subselect.cc:3017
enum Item_result result_type() const override
Definition: item_subselect.cc:1130
void store(uint i, Item *item)
Definition: item_subselect.cc:1121
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_subselect.cc:399
bool null_inside() override
Definition: item_subselect.cc:1184
Item ** addr(uint i) override
Definition: item_subselect.h:313
double val_real() override
Definition: item_subselect.cc:1198
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_subselect.cc:1135
void no_rows_in_result() override
Definition: item_subselect.cc:1167
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_subselect.cc:1243
Item_cache ** m_row
Value cache for a row or scalar subquery.
Definition: item_subselect.h:367
bool m_no_rows
no_rows_in_result
Definition: item_subselect.h:368
void reset() override
Reset state after a single execution of a subquery, useful when a dependent subquery must be evaluate...
Definition: item_subselect.cc:1116
Subquery_type subquery_type() const override
Definition: item_subselect.h:278
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_subselect.cc:1254
std::optional< ContainedSubquery > get_contained_subquery(const Query_block *outer_query_block) override
If this item represents a IN/ALL/ANY/comparison_operator subquery, return that (along with data on ho...
Definition: item_subselect.cc:3056
longlong val_int() override
Definition: item_subselect.cc:1209
uint cols() const override
Definition: item_subselect.cc:3267
virtual bool is_maxmin() const
Definition: item_subselect.h:319
bool is_single_column_scalar_subquery() const override
Definition: item_subselect.cc:1126
bool fix_fields(THD *thd, Item **ref) override
Definition: item_subselect.cc:330
Item * element_index(uint i) override
Definition: item_subselect.h:312
Item_singlerow_subselect()
Definition: item_subselect.h:274
Query_block * invalidate_and_restore_query_block()
This method is used to implement a special case of semantic tree rewriting, mandated by a SQL:2003 ex...
Definition: item_subselect.cc:902
bool collect_scalar_subqueries(uchar *) override
Definition: item_subselect.cc:2942
bool get_time(MYSQL_TIME *ltime) override
Definition: item_subselect.cc:1266
String * val_str(String *) override
Definition: item_subselect.cc:1220
bool val_bool() override
Definition: item_subselect.cc:1277
void bring_value() override
Definition: item_subselect.cc:1191
bool create_row(const mem_root_deque< Item * > &item_list, Item_cache **row, bool possibly_empty)
Makes storage for the output values for a scalar or row subquery and calculates their data and column...
Definition: item_subselect.cc:3173
bool check_cols(uint c) override
Definition: item_subselect.cc:1176
my_decimal * val_decimal(my_decimal *) override
Definition: item_subselect.cc:1231
Item_cache * m_value
Value cache of a scalar subquery.
Definition: item_subselect.h:361
Base class that is common to all subqueries and subquery predicates.
Definition: item_subselect.h:80
subselect_indexsubquery_engine * indexsubquery_engine
Only relevant for Item_in_subselect; optimized structure used for execution in place of running the e...
Definition: item_subselect.h:233
Item * replace_item_view_ref(uchar *arg) override
Transform processor.
Definition: item_subselect.cc:3157
void set_value_assigned()
Definition: item_subselect.h:139
bool clean_up_after_removal(uchar *arg) override
Clean up after removing the subquery from the item tree.
Definition: item_subselect.cc:2878
bool is_evaluated() const
Definition: item_subselect.cc:2924
enum_parsing_context m_parsing_place
where subquery is placed
Definition: item_subselect.h:243
bool collect_subqueries(uchar *) override
Definition: item_subselect.cc:2911
table_map used_tables() const override
Definition: item_subselect.h:147
void accumulate_expression(Item *item)
Accumulate properties from a selected expression within a query block.
Definition: item_subselect.cc:264
void accumulate_used_tables(table_map add_tables)
Accumulate used tables.
Definition: item_subselect.h:113
Query_expression * m_query_expr
The query expression of the subquery.
Definition: item_subselect.h:226
virtual Subquery_type subquery_type() const =0
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_subselect.h:188
table_map subquery_used_tables() const
Definition: item_subselect.h:150
bool is_uncacheable() const
Definition: item_subselect.cc:3272
void accumulate_properties()
Accumulate properties from underlying query expression.
Definition: item_subselect.cc:200
virtual bool exec(THD *thd)
Definition: item_subselect.cc:663
Query_expression * query_expr() const
Definition: item_subselect.h:84
enum_engine_type
Definition: item_subselect.h:93
@ INDEXSUBQUERY_ENGINE
Definition: item_subselect.h:93
@ HASH_SJ_ENGINE
Definition: item_subselect.h:93
@ OTHER_ENGINE
Definition: item_subselect.h:93
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_subselect.cc:862
Subquery_type
Definition: item_subselect.h:104
@ ALL_SUBQUERY
comp-op ALL quantified comparison predicate
Definition: item_subselect.h:108
@ IN_SUBQUERY
[NOT] IN subquery predicate
Definition: item_subselect.h:107
@ SCALAR_SUBQUERY
Scalar or row subquery.
Definition: item_subselect.h:105
@ ANY_SUBQUERY
comp-op ANY quantified comparison predicate
Definition: item_subselect.h:109
@ EXISTS_SUBQUERY
[NOT] EXISTS subquery predicate
Definition: item_subselect.h:106
bool explain_subquery_checker(uchar **arg) override
Register subquery to the table where it is used within a condition.
Definition: item_subselect.cc:656
bool m_value_assigned
True if value has been assigned to subquery.
Definition: item_subselect.h:259
Item * get_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 ...
Definition: item_subselect.cc:841
enum_parsing_context place()
Definition: item_subselect.h:176
virtual void reset()
Reset state after a single execution of a subquery, useful when a dependent subquery must be evaluate...
Definition: item_subselect.h:134
Item * replace_item_field(uchar *arg) override
Transform processor.
Definition: item_subselect.cc:3147
join_type get_join_type() const
Definition: item_subselect.cc:310
int in_cond_of_tab
If !=NO_PLAN_IDX: this Item is in the condition attached to the JOIN_TAB having this index in the par...
Definition: item_subselect.h:90
void accumulate_condition(Item *item)
Accumulate properties from a condition or GROUP/ORDER within a query block.
Definition: item_subselect.cc:275
virtual AccessPath * root_access_path() const
Definition: item_subselect.h:102
void create_iterators(THD *thd)
Definition: item_subselect.cc:280
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_subselect.cc:315
Query_result_interceptor * m_query_result
The query result object associated with the query expression.
Definition: item_subselect.h:229
table_map m_subquery_used_tables
cache of used tables from subquery only (not including LHS of IN subquery)
Definition: item_subselect.h:238
const TABLE * get_table() const
Definition: item_subselect.cc:300
enum Type type() const override
Definition: item_subselect.cc:839
bool fix_fields(THD *thd, Item **ref) override
Definition: item_subselect.cc:593
void set_indexsubquery_engine(subselect_indexsubquery_engine *eng)
Definition: item_subselect.h:156
const char * func_name() const override
Definition: item_subselect.h:183
void bind(Query_expression *qe)
Bind this subquery object with the supplied query expression.
Definition: item_subselect.cc:144
void reset_value_assigned()
Definition: item_subselect.h:140
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_subselect.h:148
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_subselect.cc:853
bool walk(Item_processor processor, enum_walk walk, uchar *arg) override
Traverses a tree of Items in prefix and/or postfix order.
Definition: item_subselect.cc:635
Item_subselect()
Definition: item_subselect.h:214
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_subselect.h:142
const Index_lookup & index_lookup() const
Definition: item_subselect.cc:305
enum_engine_type engine_type() const
Definition: item_subselect.cc:286
bool is_value_assigned() const
Definition: item_subselect.h:138
Item_result_field super
Definition: item_subselect.h:81
bool m_traced_before
Whether or not execution of this subquery has been traced by optimizer tracing already.
Definition: item_subselect.h:266
bool inform_item_in_cond_of_tab(uchar *arg) override
Tells an Item that it is in the condition of a JOIN_TAB of a query block.
Definition: item_subselect.cc:2850
virtual void reset_has_values()
Used by max/min subquery to initialize value presence registration mechanism.
Definition: item_subselect.h:171
bool subq_opt_away_processor(uchar *arg) override
Mark the subquery as optimized away, for EXPLAIN.
Definition: item_subselect.cc:2862
uint m_max_columns
allowed number of columns (1 for scalar subqueries)
Definition: item_subselect.h:241
virtual bool is_single_column_scalar_subquery() const
Definition: item_subselect.h:125
void fix_after_pullout(Query_block *parent_query_block, Query_block *removed_query_block) override
Definition: item_subselect.cc:737
Item_subselect(const POS &pos)
Definition: item_subselect.h:215
table_map m_used_tables_cache
cache of used tables
Definition: item_subselect.h:236
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:936
void set_subquery()
Set the "has subquery" property.
Definition: item.h:3394
bool null_value
True if item is null.
Definition: item.h:3667
Type
Definition: item.h:971
Bool_test
< Modifier for result transformation
Definition: item.h:1013
@ BOOL_NOT_FALSE
Definition: item.h:1018
@ BOOL_NOT_TRUE
Definition: item.h:1017
@ BOOL_IS_TRUE
Definition: item.h:1014
@ BOOL_IS_FALSE
Definition: item.h:1015
@ BOOL_IDENTITY
Definition: item.h:1020
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
bool update_null_value()
Make sure the null_value member has a correct value.
Definition: item.cc:7627
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1716
Definition: sql_optimizer.h:133
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
Definition: parse_tree_nodes.h:1773
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:231
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1163
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:626
Definition: item_subselect.cc:1288
Definition: query_result.h:181
Query result class for scalar and row subqueries.
Definition: item_subselect.cc:107
Base class for result from a subquery.
Definition: query_result.h:312
Definition: sql_union.h:40
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
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
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
Compute an IN predicate via a hash semi-join.
Definition: item_subselect.h:834
void create_iterators(THD *thd) override
Definition: item_subselect.cc:3511
void print(const THD *thd, String *str, enum_query_type query_type) override
Print the state of this engine into a string for debugging and views.
Definition: item_subselect.cc:3744
nulls_exist
Existence of inner NULLs in materialized table: By design, other values than IRRELEVANT_OR_FALSE are ...
Definition: item_subselect.h:846
@ NEX_TRUE
they matter, and we know there exists at least one.
Definition: item_subselect.h:852
@ NEX_UNKNOWN
they matter, and we don't know yet if they exists
Definition: item_subselect.h:850
@ NEX_IRRELEVANT_OR_FALSE
none, or they don't matter
Definition: item_subselect.h:848
void cleanup() override
Cleanup performed after each execution.
Definition: item_subselect.cc:3589
unique_ptr_destroy_only< RowIterator > m_iterator
Definition: item_subselect.h:856
subselect_hash_sj_engine(Item_in_subselect *in_predicate, Query_expression *query_expr)
Definition: item_subselect.h:863
TABLE * get_table() const
Definition: item_subselect.h:877
~subselect_hash_sj_engine() override
Definition: item_subselect.cc:3578
Query_result_interceptor * saved_result
Saved result object, must be restored after use.
Definition: item_subselect.h:860
enum nulls_exist mat_table_has_nulls
Definition: item_subselect.h:854
bool is_materialized
Definition: item_subselect.h:837
Query_expression *const m_query_expr
Definition: item_subselect.h:855
bool has_zero_rows
Definition: item_subselect.h:840
const Index_lookup & index_lookup() const
Definition: item_subselect.h:878
bool exec(THD *thd) override
Execute a subquery IN predicate via materialization.
Definition: item_subselect.cc:3624
enum_engine_type engine_type() const override
Definition: item_subselect.h:875
AccessPath * root_access_path() const
Definition: item_subselect.h:880
bool setup(THD *thd, const mem_root_deque< Item * > &tmp_columns)
Create all structures needed for subquery execution using hash semijoin.
Definition: item_subselect.cc:3340
enum join_type get_join_type() const
Definition: item_subselect.h:879
AccessPath * m_root_access_path
Definition: item_subselect.h:857
A subquery execution engine that evaluates the subquery by doing index lookups in a single table's in...
Definition: item_subselect.h:773
Item * m_cond
The WHERE condition of the subquery.
Definition: item_subselect.h:781
TABLE * table
Table which is read, using one of eq_ref, ref, ref_or_null.
Definition: item_subselect.h:777
virtual ~subselect_indexsubquery_engine()=default
virtual void cleanup()
Definition: item_subselect.h:816
virtual bool exec(THD *thd)
Definition: item_subselect.cc:3256
virtual void print(const THD *thd, String *str, enum_query_type query_type)
Definition: item_subselect.cc:3276
virtual void create_iterators(THD *)
Definition: item_subselect.h:817
Item * m_having
Definition: item_subselect.h:793
join_type type
Definition: item_subselect.h:780
enum_engine_type
Definition: item_subselect.h:798
@ HASH_SJ_ENGINE
Definition: item_subselect.h:798
@ INDEXSUBQUERY_ENGINE
Definition: item_subselect.h:798
Index_lookup ref
Definition: item_subselect.h:779
subselect_indexsubquery_engine(TABLE *table, Table_ref *table_ref, const Index_lookup &ref, enum join_type join_type, Item_in_subselect *subs, Item *where, Item *having)
Definition: item_subselect.h:800
ulonglong m_hash
Hash value calculated by RefIterator, when needed.
Definition: item_subselect.h:782
virtual enum_engine_type engine_type() const
Definition: item_subselect.h:815
Item_in_subselect * item
Definition: item_subselect.h:795
Table_ref * table_ref
Definition: item_subselect.h:778
Comp_creator *(*)(bool invert) chooser_compare_func_creator
Convenience typedef for a function that returns factories for Item comparators (ie....
Definition: comp_creator.h:39
static int cmp(Bigint *a, Bigint *b)
Definition: dtoa.cc:1057
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
This file contains the field type.
bool subquery_allows_materialization(THD *thd, Query_block *query_block, const Query_block *outer)
Check if the subquery predicate can be executed via materialization.
Definition: sql_resolver.cc:1040
Item * all_any_subquery_creator(Item *left_expr, chooser_compare_func_creator cmp, bool all, Query_block *select)
Construct ALL/ANY/SOME subquery Item.
Definition: sql_parse.cc:6718
bool(Item::* Item_analyzer)(uchar **argp)
Definition: item.h:718
Item *(Item::* Item_transformer)(uchar *arg)
Type for transformers used by Item::transform and Item::compile.
Definition: item.h:727
Item * remove_in2exists_conds(Item *conds)
Removes every predicate injected by IN->EXISTS.
Definition: item_subselect.cc:465
Subquery_strategy
Classes that represent predicates over table subqueries: [NOT] EXISTS, [NOT] IN, ANY/SOME and ALL.
Definition: item_subselect.h:406
@ CANDIDATE_FOR_SEMIJOIN
Candidate for semi-join flattening.
@ UNSPECIFIED
Nothing decided yet.
@ SUBQ_EXISTS
Evaluate as EXISTS subquery (possibly after rewriting from another type)
@ DERIVED_TABLE
Rewrite to joined derived table.
@ DELETED
Subquery has been deleted, probably because it was always false.
@ CANDIDATE_FOR_IN2EXISTS_OR_MAT
Candidate for rewriting IN(subquery) to EXISTS, or subquery materialization.
@ SEMIJOIN
Semi-join flattening.
@ SUBQ_MATERIALIZATION
Subquery materialization (HASH_SJ_ENGINE)
@ CANDIDATE_FOR_DERIVED_TABLE
Candidate for rewriting to joined derived table.
bool is_quantified_comp_predicate(Item *item)
Definition: item_subselect.cc:2817
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
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
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
Time declarations shared between the server and client API: you should not add anything to this heade...
static char * where
Definition: mysqldump.cc:152
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
std::string join(const detail::range auto &rng, std::string_view delim)
join elements of a range into a string separated by a delimiter.
Definition: string.h:74
int add_tables(PFS_engine_table_share_proxy **, unsigned int) noexcept
Definition: pfs_plugin_table_v1_all_empty.cc:33
enum_parsing_context
Names for different query parse tree parts.
Definition: parse_tree_node_base.h:61
@ CTX_NONE
Empty value.
Definition: parse_tree_node_base.h:62
File containing constants that can be used throughout the server.
enum_walk
Enumeration for {Item,Query_block[_UNIT],Table_function}walk.
Definition: sql_const.h:287
bool(Item::*)(unsigned char *) Item_processor
Processor type for {Item,Query_block[_UNIT],Table_function}walk.
Definition: sql_const.h:305
enum_condition_context
Enumeration for Query_block::condition_context.
Definition: sql_const.h:311
Common types of the Optimizer, used by optimization and execution.
join_type
Definition: sql_opt_exec_shared.h:186
@ JT_UNKNOWN
Definition: sql_opt_exec_shared.h:188
#define NO_PLAN_IDX
undefined index
Definition: sql_opt_exec_shared.h:55
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:213
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
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
Structure used for index-based lookups.
Definition: sql_opt_exec_shared.h:67
This bundles several pieces of information useful when doing the IN->EXISTS transform.
Definition: item_subselect.h:708
bool added_to_where
True: if IN->EXISTS has been done and has added a condition to the subquery's WHERE clause.
Definition: item_subselect.h:713
bool dependent_before
True: if subquery was dependent (correlated) before IN->EXISTS was done.
Definition: item_subselect.h:718
bool dependent_after
True: if subquery was dependent (correlated) after IN->EXISTS was done.
Definition: item_subselect.h:723
Argument for walk method replace_scalar_subquery.
Definition: item_subselect.h:324
Query_block * m_outer_query_block
The transformed query block.
Definition: item_subselect.h:327
Field * m_field
the replacement field
Definition: item_subselect.h:326
Query_block * m_inner_query_block
The immediately surrounding query.
Definition: item_subselect.h:328
bool m_add_coalesce
Definition: item_subselect.h:331
Item_singlerow_subselect * m_target
subquery to be replaced with field
Definition: item_subselect.h:325
Scalar_subquery_replacement(Item_singlerow_subselect *target, Field *field, Query_block *select, bool add_coalesce)
Definition: item_subselect.h:332
argument used by walk method collect_scalar_subqueries ("css")
Definition: item_subselect.h:196
Collect_subq_info(Query_block *owner)
Definition: item_subselect.h:200
Query_block * m_query_block
Definition: item_subselect.h:199
std::vector< Item_subselect * > list
< accumulated all subq (or aggregates) found
Definition: item_subselect.h:198
bool contains(Query_expression *candidate)
Definition: item_subselect.h:201
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
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
@ INT_RESULT
double
Definition: udf_registration_types.h:43
static int all(site_def const *s, node_no node)
Definition: xcom_transport.cc:885