1#ifndef AGGREGATE_CHECK_INCLUDED
2#define AGGREGATE_CHECK_INCLUDED
507#include <sys/types.h>
697 bool weak_side_upwards);
699 table_map weak_tables,
bool weak_side_upwards);
701 bool weak_side_upwards);
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
bool is_true() const
Definition: item.h:601
Checks for queries which have DISTINCT.
Definition: aggregate_check.h:530
Distinct_check(const Distinct_check &)=delete
Query_block *const select
Query block which we are validating.
Definition: aggregate_check.h:541
Item_ident * failed_ident
Identifier which triggered an error.
Definition: aggregate_check.h:543
Distinct_check & operator=(const Distinct_check &)=delete
Distinct_check(Query_block *select_arg)
Definition: aggregate_check.h:532
Checks for queries which have GROUP BY or aggregate functions.
Definition: aggregate_check.h:560
SQL_I_List< ORDER > m_added_by_transform
GROUP BY list non single column expressions entries added by transform.
Definition: aggregate_check.h:663
MEM_ROOT *const m_root
Memory for allocations (like of 'fd')
Definition: aggregate_check.h:644
Group_check(Query_block *select_arg, MEM_ROOT *root, Table_ref *table_arg)
Private ctor, for a Group_check to build a child Group_check.
Definition: aggregate_check.h:669
Item_ident * failed_ident
Identifier which triggered an error.
Definition: aggregate_check.h:661
void add_to_fd(table_map m)
Definition: aggregate_check.h:688
Query_block *const select
Query block which we are validating.
Definition: aggregate_check.h:601
Group_check & operator=(const Group_check &)=delete
enum_ident_check
Enum for argument of do_ident_check()
Definition: aggregate_check.h:708
@ CHECK_COLUMN
Definition: aggregate_check.h:708
@ CHECK_STRONG_SIDE_COLUMN
Definition: aggregate_check.h:708
@ CHECK_GROUP
Definition: aggregate_check.h:708
Group_check(Query_block *select_arg, MEM_ROOT *root)
Definition: aggregate_check.h:562
Group_check(const Group_check &)=delete
Table_ref *const table
The Group_check employed to validate one query block, the one on which check_query() runs,...
Definition: aggregate_check.h:630
~Group_check()
Definition: aggregate_check.h:585
bool search_in_underlying
"Underlying" == expressions which are underlying in an identifier.
Definition: aggregate_check.h:612
bool is_child() const
Definition: aggregate_check.h:666
Mem_root_array< Group_check * > mat_tables
Children Group_checks of 'this'.
Definition: aggregate_check.h:659
table_map recheck_nullable_keys
Map of tables for which we discovered known-not-nullable columns.
Definition: aggregate_check.h:657
bool local_column(Item *item) const
Shortcut for common use of Item::local_column()
Definition: aggregate_check.h:684
bool non_null_in_source
This member is readable only if this is a child Group_check.
Definition: aggregate_check.h:618
ulonglong group_in_fd
Bit N is set if the N-th expression of GROUP BY is functionally dependent on source columns.
Definition: aggregate_check.h:641
Mem_root_array< Item_ident * > fd
Columns which are local to 'select' and functionally dependent on an initial set of "source" columns ...
Definition: aggregate_check.h:653
table_map whole_tables_fd
Map of tables for which all columns can be considered part of 'fd'.
Definition: aggregate_check.h:655
bool aggregate_check_group(uchar *arg) override
Definition: item_cmpfunc.cc:7605
bool aggregate_check_distinct(uchar *arg) override
Definition: item_cmpfunc.cc:7612
bool aggregate_check_group(uchar *arg) override
This function is expected to check if GROUPING function with its arguments is "group-invariant".
Definition: item_sum.cc:6371
bool aggregate_check_distinct(uchar *arg) override
Used by Distinct_check::check_query to determine whether an error should be returned if the GROUPING ...
Definition: item_sum.cc:6341
bool is_strong_side_column_not_in_fd(uchar *arg) override
Definition: item.cc:11055
bool aggregate_check_group(uchar *arg) override
Definition: item.cc:11050
bool is_column_not_in_fd(uchar *arg) override
Definition: item.cc:11063
bool aggregate_check_distinct(uchar *arg) override
Definition: item.cc:11002
bool aggregate_check_distinct(uchar *arg) override
Definition: item_sum.cc:641
bool aggregate_check_group(uchar *arg) override
Definition: item_sum.cc:665
Utility mixin class to be able to walk() only parts of item trees.
Definition: item.h:738
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
virtual Bool3 local_column(const Query_block *) const
Definition: item.h:2930
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
A per-session context which is always available at any point of execution, because in practice it's a...
Definition: opt_trace_context.h:94
A JSON object (unordered set of key/value pairs).
Definition: opt_trace.h:802
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1175
SQL_I_List< ORDER > group_list
GROUP BY clause.
Definition: sql_lex.h:1962
decltype(SQL_I_List< ORDER >::elements) m_no_of_added_exprs
For an explicitly grouped, correlated, scalar subquery which is transformed to join with derived tabl...
Definition: sql_lex.h:1976
Simple intrusive linked list.
Definition: sql_list.h:47
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
void add_to_fd(Item *item, bool local_column, bool add_to_mat_table=true)
Definition: aggregate_check.cc:498
bool do_ident_check(Item_ident *i, table_map tm, enum enum_ident_check type)
Does one low-level check on one Item_ident.
Definition: aggregate_check.cc:1203
Item * select_expression(uint idx)
Definition: aggregate_check.cc:592
void find_fd_in_cond(Item *cond, table_map weak_tables, bool weak_side_upwards)
Searches for equality-based functional dependencies in a condition.
Definition: aggregate_check.cc:1083
void analyze_scalar_eq(Item *cond, Item *left_item, Item *right_item, table_map weak_tables, bool weak_side_upwards)
Helper function.
Definition: aggregate_check.cc:994
void to_opt_trace2(Opt_trace_context *ctx, Opt_trace_object *parent)
Utility function for to_opt_trace(), as we need recursion in children Group_checks.
Definition: aggregate_check.cc:1166
void find_fd_in_joined_table(mem_root_deque< Table_ref * > *join_list)
Searches for equality-based functional dependencies in the condition of a join nest,...
Definition: aggregate_check.cc:1107
bool is_fd_on_source(Item *item)
Tells if 'item' is functionally dependent ("FD") on source columns.
Definition: aggregate_check.cc:343
Item * get_fd_equal(Item *item)
Definition: aggregate_check.cc:873
bool check_query(THD *thd)
Rejects the query if it has a combination of DISTINCT and ORDER BY which could lead to randomly order...
Definition: aggregate_check.cc:111
bool check_query(THD *thd)
Rejects the query if it does aggregation or grouping, and expressions in its SELECT list,...
Definition: aggregate_check.cc:180
bool check_expression(THD *thd, Item *expr, bool in_select_list)
Validates one expression (this forms one step of check_query()).
Definition: aggregate_check.cc:275
void to_opt_trace(THD *thd)
Writes "check information" to the optimizer trace.
Definition: aggregate_check.cc:1153
bool is_in_fd(Item *item)
is_in_fd() is low-level compared to is_fd_on_source().
Definition: aggregate_check.cc:685
bool is_in_fd_of_underlying(Item_ident *item)
See if we can derive a FD from a column which has an underlying expression.
Definition: aggregate_check.cc:745
void analyze_conjunct(Item *cond, Item *conjunct, table_map weak_tables, bool weak_side_upwards)
Searches for equality-based functional dependences in an AND-ed part of a condition (a conjunct).
Definition: aggregate_check.cc:896
void add_to_source_of_mat_table(Item_field *item_field, Table_ref *tl)
If we just added a column of a materialized table to 'fd', we record this fact in a new Group_check (...
Definition: aggregate_check.cc:620
void find_group_in_fd(Item *item)
This function must be called every time we discover an item which is FD on source columns,...
Definition: aggregate_check.cc:559
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
uint64_t table_map
Definition: my_table_map.h:30
required string type
Definition: replication_group_member_actions.proto:34
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83