1#ifndef AGGREGATE_CHECK_INCLUDED
2#define AGGREGATE_CHECK_INCLUDED
506#include <sys/types.h>
679 bool weak_side_upwards);
681 table_map weak_tables,
bool weak_side_upwards);
683 bool weak_side_upwards);
bool is_true() const
Definition: item.h:602
Checks for queries which have DISTINCT.
Definition: aggregate_check.h:529
Distinct_check(const Distinct_check &)=delete
Query_block *const select
Query block which we are validating.
Definition: aggregate_check.h:540
Item_ident * failed_ident
Identifier which triggered an error.
Definition: aggregate_check.h:542
Distinct_check & operator=(const Distinct_check &)=delete
Distinct_check(Query_block *select_arg)
Definition: aggregate_check.h:531
Checks for queries which have GROUP BY or aggregate functions.
Definition: aggregate_check.h:559
MEM_ROOT *const m_root
Memory for allocations (like of 'fd')
Definition: aggregate_check.h:628
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:651
Item_ident * failed_ident
Identifier which triggered an error.
Definition: aggregate_check.h:645
void add_to_fd(table_map m)
Definition: aggregate_check.h:670
Query_block *const select
Query block which we are validating.
Definition: aggregate_check.h:585
Group_check & operator=(const Group_check &)=delete
enum_ident_check
Enum for argument of do_ident_check()
Definition: aggregate_check.h:690
@ CHECK_COLUMN
Definition: aggregate_check.h:690
@ CHECK_STRONG_SIDE_COLUMN
Definition: aggregate_check.h:690
@ CHECK_GROUP
Definition: aggregate_check.h:690
Group_check(Query_block *select_arg, MEM_ROOT *root)
Definition: aggregate_check.h:561
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:614
~Group_check()
Definition: aggregate_check.h:574
bool search_in_underlying
"Underlying" == expressions which are underlying in an identifier.
Definition: aggregate_check.h:596
bool is_child() const
Definition: aggregate_check.h:648
Mem_root_array< Group_check * > mat_tables
Children Group_checks of 'this'.
Definition: aggregate_check.h:643
table_map recheck_nullable_keys
Map of tables for which we discovered known-not-nullable columns.
Definition: aggregate_check.h:641
bool local_column(Item *item) const
Shortcut for common use of Item::local_column()
Definition: aggregate_check.h:666
bool non_null_in_source
This member is readable only if this is a child Group_check.
Definition: aggregate_check.h:602
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:625
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:637
table_map whole_tables_fd
Map of tables for which all columns can be considered part of 'fd'.
Definition: aggregate_check.h:639
bool aggregate_check_group(uchar *arg) override
Definition: item_cmpfunc.cc:7367
bool aggregate_check_distinct(uchar *arg) override
Definition: item_cmpfunc.cc:7374
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:6276
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:6246
bool is_strong_side_column_not_in_fd(uchar *arg) override
Definition: item.cc:10916
bool aggregate_check_group(uchar *arg) override
Definition: item.cc:10911
bool is_column_not_in_fd(uchar *arg) override
Definition: item.cc:10924
bool aggregate_check_distinct(uchar *arg) override
Definition: item.cc:10863
bool aggregate_check_distinct(uchar *arg) override
Definition: item_sum.cc:621
bool aggregate_check_group(uchar *arg) override
Definition: item_sum.cc:645
Utility mixin class to be able to walk() only parts of item trees.
Definition: item.h:740
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
virtual Bool3 local_column(const Query_block *) const
Definition: item.h:2823
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:425
A per-session context which is always available at any point of execution, because in practice it's a...
Definition: opt_trace_context.h:91
A JSON object (unordered set of key/value pairs).
Definition: opt_trace.h:798
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1162
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:109
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
void add_to_fd(Item *item, bool local_column, bool add_to_mat_table=true)
Definition: aggregate_check.cc:490
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:1199
Item * select_expression(uint idx)
Definition: aggregate_check.cc:584
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:1079
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:990
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:1162
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:1103
bool is_fd_on_source(Item *item)
Tells if 'item' is functionally dependent ("FD") on source columns.
Definition: aggregate_check.cc:335
Item * get_fd_equal(Item *item)
Definition: aggregate_check.cc:869
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:110
bool check_query(THD *thd)
Rejects the query if it does aggregation or grouping, and expressions in its SELECT list,...
Definition: aggregate_check.cc:179
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:267
void to_opt_trace(THD *thd)
Writes "check information" to the optimizer trace.
Definition: aggregate_check.cc:1149
bool is_in_fd(Item *item)
is_in_fd() is low-level compared to is_fd_on_source().
Definition: aggregate_check.cc:677
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:737
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:892
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:612
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:551
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:55
unsigned char uchar
Definition: my_inttypes.h:51
uint64_t table_map
Definition: my_table_map.h:29
static int destroy(mysql_cond_t *that, const char *, unsigned int)
Definition: mysql_cond_v1_native.cc:42
required string type
Definition: replication_group_member_actions.proto:33
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82