1#ifndef AGGREGATE_CHECK_INCLUDED
2#define AGGREGATE_CHECK_INCLUDED
506#include <sys/types.h>
677 bool weak_side_upwards);
679 table_map weak_tables,
bool weak_side_upwards);
681 bool weak_side_upwards);
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:250
bool is_true() const
Definition: item.h:603
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:626
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:649
Item_ident * failed_ident
Identifier which triggered an error.
Definition: aggregate_check.h:643
void add_to_fd(table_map m)
Definition: aggregate_check.h:668
Query_block *const select
Query block which we are validating.
Definition: aggregate_check.h:583
Group_check & operator=(const Group_check &)=delete
enum_ident_check
Enum for argument of do_ident_check()
Definition: aggregate_check.h:688
@ CHECK_COLUMN
Definition: aggregate_check.h:688
@ CHECK_STRONG_SIDE_COLUMN
Definition: aggregate_check.h:688
@ CHECK_GROUP
Definition: aggregate_check.h:688
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:612
~Group_check()
Definition: aggregate_check.h:574
bool search_in_underlying
"Underlying" == expressions which are underlying in an identifier.
Definition: aggregate_check.h:594
bool is_child() const
Definition: aggregate_check.h:646
Mem_root_array< Group_check * > mat_tables
Children Group_checks of 'this'.
Definition: aggregate_check.h:641
table_map recheck_nullable_keys
Map of tables for which we discovered known-not-nullable columns.
Definition: aggregate_check.h:639
bool local_column(Item *item) const
Shortcut for common use of Item::local_column()
Definition: aggregate_check.h:664
bool non_null_in_source
This member is readable only if this is a child Group_check.
Definition: aggregate_check.h:600
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:623
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:635
table_map whole_tables_fd
Map of tables for which all columns can be considered part of 'fd'.
Definition: aggregate_check.h:637
bool aggregate_check_group(uchar *arg) override
Definition: item_cmpfunc.cc:7564
bool aggregate_check_distinct(uchar *arg) override
Definition: item_cmpfunc.cc:7571
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:6322
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:6292
bool is_strong_side_column_not_in_fd(uchar *arg) override
Definition: item.cc:11028
bool aggregate_check_group(uchar *arg) override
Definition: item.cc:11023
bool is_column_not_in_fd(uchar *arg) override
Definition: item.cc:11036
bool aggregate_check_distinct(uchar *arg) override
Definition: item.cc:10975
bool aggregate_check_distinct(uchar *arg) override
Definition: item_sum.cc:632
bool aggregate_check_group(uchar *arg) override
Definition: item_sum.cc:656
Utility mixin class to be able to walk() only parts of item trees.
Definition: item.h:741
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:933
virtual Bool3 local_column(const Query_block *) const
Definition: item.h:2905
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:801
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1161
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:110
void add_to_fd(Item *item, bool local_column, bool add_to_mat_table=true)
Definition: aggregate_check.cc:497
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:1206
Item * select_expression(uint idx)
Definition: aggregate_check.cc:591
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:1086
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:997
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:1169
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:1110
bool is_fd_on_source(Item *item)
Tells if 'item' is functionally dependent ("FD") on source columns.
Definition: aggregate_check.cc:342
Item * get_fd_equal(Item *item)
Definition: aggregate_check.cc:876
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:274
void to_opt_trace(THD *thd)
Writes "check information" to the optimizer trace.
Definition: aggregate_check.cc:1156
bool is_in_fd(Item *item)
is_in_fd() is low-level compared to is_fd_on_source().
Definition: aggregate_check.cc:684
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:744
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:899
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:619
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:558
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
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