1#ifndef AGGREGATE_CHECK_INCLUDED
2#define AGGREGATE_CHECK_INCLUDED
507#include <sys/types.h>
680 bool weak_side_upwards);
682 table_map weak_tables,
bool weak_side_upwards);
684 bool weak_side_upwards);
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
MEM_ROOT *const m_root
Memory for allocations (like of 'fd')
Definition: aggregate_check.h:629
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:652
Item_ident * failed_ident
Identifier which triggered an error.
Definition: aggregate_check.h:646
void add_to_fd(table_map m)
Definition: aggregate_check.h:671
Query_block *const select
Query block which we are validating.
Definition: aggregate_check.h:586
Group_check & operator=(const Group_check &)=delete
enum_ident_check
Enum for argument of do_ident_check()
Definition: aggregate_check.h:691
@ CHECK_COLUMN
Definition: aggregate_check.h:691
@ CHECK_STRONG_SIDE_COLUMN
Definition: aggregate_check.h:691
@ CHECK_GROUP
Definition: aggregate_check.h:691
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:615
~Group_check()
Definition: aggregate_check.h:575
bool search_in_underlying
"Underlying" == expressions which are underlying in an identifier.
Definition: aggregate_check.h:597
bool is_child() const
Definition: aggregate_check.h:649
Mem_root_array< Group_check * > mat_tables
Children Group_checks of 'this'.
Definition: aggregate_check.h:644
table_map recheck_nullable_keys
Map of tables for which we discovered known-not-nullable columns.
Definition: aggregate_check.h:642
bool local_column(Item *item) const
Shortcut for common use of Item::local_column()
Definition: aggregate_check.h:667
bool non_null_in_source
This member is readable only if this is a child Group_check.
Definition: aggregate_check.h:603
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:626
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:638
table_map whole_tables_fd
Map of tables for which all columns can be considered part of 'fd'.
Definition: aggregate_check.h:640
bool aggregate_check_group(uchar *arg) override
Definition: item_cmpfunc.cc:7397
bool aggregate_check_distinct(uchar *arg) override
Definition: item_cmpfunc.cc:7404
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:6278
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:6248
bool is_strong_side_column_not_in_fd(uchar *arg) override
Definition: item.cc:10826
bool aggregate_check_group(uchar *arg) override
Definition: item.cc:10821
bool is_column_not_in_fd(uchar *arg) override
Definition: item.cc:10834
bool aggregate_check_distinct(uchar *arg) override
Definition: item.cc:10773
bool aggregate_check_distinct(uchar *arg) override
Definition: item_sum.cc:619
bool aggregate_check_group(uchar *arg) override
Definition: item_sum.cc:643
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:2763
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:90
A JSON object (unordered set of key/value pairs).
Definition: opt_trace.h:799
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1156
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:110
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
void add_to_fd(Item *item, bool local_column, bool add_to_mat_table=true)
Definition: aggregate_check.cc:491
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:1200
Item * select_expression(uint idx)
Definition: aggregate_check.cc:585
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:1080
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:991
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:1163
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:1104
bool is_fd_on_source(Item *item)
Tells if 'item' is functionally dependent ("FD") on source columns.
Definition: aggregate_check.cc:336
Item * get_fd_equal(Item *item)
Definition: aggregate_check.cc:870
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:268
void to_opt_trace(THD *thd)
Writes "check information" to the optimizer trace.
Definition: aggregate_check.cc:1150
bool is_in_fd(Item *item)
is_in_fd() is low-level compared to is_fd_on_source().
Definition: aggregate_check.cc:678
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:738
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:893
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:613
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:552
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
static int destroy(mysql_cond_t *that, const char *, unsigned int)
Definition: mysql_cond_v1_native.cc:54
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
unsigned int uint
Definition: uca9-dump.cc:75