24#ifndef SQL_JOIN_OPTIMIZER_RELATIONAL_EXPRESSION_H
25#define SQL_JOIN_OPTIMIZER_RELATIONAL_EXPRESSION_H
249 return ItemsAreEqual(cond, other, true);
bool IsSubset(uint64_t x, uint64_t y)
Definition: bit_utils.h:221
bool Overlaps(uint64_t x, uint64_t y)
Definition: bit_utils.h:229
The collection of CompanionSet objects for a given JoinHypergraph.
Definition: relational_expression.h:302
CompanionSet * Find(table_map tables)
Definition: relational_expression.h:312
CompanionSet * FindInternal(table_map tables) const
For a given set of tables, find the CompanionSet they are part of Returns nullptr if the tables are i...
Definition: relational_expression.cc:199
CompanionSetCollection(const CompanionSetCollection &)=delete
No copying.
void Compute(THD *thd, RelationalExpression *expr, CompanionSet *current_set)
Compute the CompanionSet of 'expr' and all of its descendants.
Definition: relational_expression.cc:149
std::array< CompanionSet *, MAX_TABLES > m_table_num_to_companion_set
A mapping from table number to CompanionSet.
Definition: relational_expression.h:323
CompanionSetCollection & operator=(const CompanionSetCollection &)=delete
CompanionSetCollection(THD *thd, struct RelationalExpression *root)
Definition: relational_expression.h:304
std::string ToString() const
For trace and debugging.
Definition: relational_expression.cc:181
const CompanionSet * Find(table_map tables) const
Definition: relational_expression.h:314
RelationalExpression objects in the same companion set are those that are inner-joined against each o...
Definition: relational_expression.h:78
CompanionSet & operator=(const CompanionSet &)=delete
Mem_root_array< EqualTerm > m_equal_terms
The set of sets of fields in equijoin predicates in this companion set.
Definition: relational_expression.h:127
table_map GetEqualityMap(const Field &field) const
If 'field' is part of an equijoin predicate in this CompanionSet, return a table_map of the tables in...
Definition: relational_expression.cc:121
CompanionSet(const CompanionSet &)=delete
No copying.
CompanionSet(THD *thd)
Definition: relational_expression.h:82
std::string ToString() const
For tracing and debugging.
Definition: relational_expression.cc:132
void AddEquijoinCondition(THD *thd, const Item_func_eq &eq)
Add the set of equal fields specified by 'func_eq'.
Definition: relational_expression.cc:66
Base class for the equality comparison operators = and <=>.
Definition: item_cmpfunc.h:991
Implements the comparison operator equals (=)
Definition: item_cmpfunc.h:1056
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:936
virtual table_map used_tables() const
Definition: item.h:2338
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Definition: overflow_bitset.h:78
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
table_map map() const
Return table map derived from table number.
Definition: table.h:3982
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
@ ANTI
Left antijoin, i.e.
@ SEMI
Left semijoin, i.e.
uint64_t table_map
Definition: my_table_map.h:30
uint64_t NodeMap
Since our graphs can never have more than 61 tables, node sets and edge lists are implemented using 6...
Definition: node_map.h:40
OverflowBitset is a fixed-size (once allocated) bitmap that is optimized for the common case of few e...
void ForEachOperator(RelationalExpression *expr, Func &&func)
Definition: relational_expression.h:293
void ForEachJoinOperator(RelationalExpression *expr, Func &&func)
Definition: relational_expression.h:283
bool PassesConflictRules(hypergraph::NodeMap joined_tables, const RelationalExpression *expr)
Definition: relational_expression.h:262
bool OperatorIsCommutative(const RelationalExpression &expr)
Definition: relational_expression.h:275
Access paths are a query planning structure that correspond 1:1 to iterators, in that an access path ...
Definition: access_path.h:213
Definition: relational_expression.h:45
double selectivity
Definition: relational_expression.h:47
Mem_root_array< ContainedSubquery > contained_subqueries
Definition: relational_expression.h:46
OverflowBitset redundant_against_sargable_predicates
Definition: relational_expression.h:55
This represents equality between a set of fields, i.e.
Definition: relational_expression.h:108
FieldArray * fields
The fields that are equal to each other.
Definition: relational_expression.h:110
table_map tables
A map of all tables in 'fields'.
Definition: relational_expression.h:113
Definition: relational_expression.h:63
hypergraph::NodeMap required_nodes
Definition: relational_expression.h:65
hypergraph::NodeMap needed_to_activate_rule
Definition: relational_expression.h:64
Represents an expression tree in the relational algebra of joins.
Definition: relational_expression.h:145
int join_predicate_last
Definition: relational_expression.h:231
Mem_root_array< CachedPropertiesForPredicate > properties_for_equijoin_conditions
Definition: relational_expression.h:219
const Mem_root_array< Item * > & pushable_conditions() const
Definition: relational_expression.h:238
Mem_root_array< Item_eq_base * > equijoin_conditions
Definition: relational_expression.h:206
int join_predicate_first
Definition: relational_expression.h:231
Mem_root_array< ConflictRule > conflict_rules
Definition: relational_expression.h:236
enum RelationalExpression::Type type
CompanionSet * companion_set
Definition: relational_expression.h:197
RelationalExpression(THD *thd)
Definition: relational_expression.h:178
void AddPushable(Item *cond)
Add a condition that can be pushed down to the acces path for 'table'.
Definition: relational_expression.h:243
table_map tables_in_subtree
Definition: relational_expression.h:186
const Table_ref * table
Definition: relational_expression.h:194
hypergraph::NodeMap nodes_in_subtree
Definition: relational_expression.h:191
Mem_root_array< RelationalExpression * > multi_children
Definition: relational_expression.h:204
table_map conditions_used_tables
Definition: relational_expression.h:224
Mem_root_array< Item * > join_conditions
Definition: relational_expression.h:205
Type
Definition: relational_expression.h:146
@ SEMIJOIN
Left semijoin.
Definition: relational_expression.h:151
@ MULTI_INNER_JOIN
Definition: relational_expression.h:173
@ STRAIGHT_INNER_JOIN
Definition: relational_expression.h:159
@ ANTIJOIN
Left antijoin.
Definition: relational_expression.h:154
@ INNER_JOIN
Definition: relational_expression.h:147
@ FULL_OUTER_JOIN
Definition: relational_expression.h:166
@ TABLE
Definition: relational_expression.h:175
@ LEFT_JOIN
Definition: relational_expression.h:148
Mem_root_array< Item * > m_pushable_conditions
Conditions that can be pushed down to the acces path for 'table'.
Definition: relational_expression.h:257
bool join_conditions_reject_all_rows
Definition: relational_expression.h:223
Mem_root_array< CachedPropertiesForPredicate > properties_for_join_conditions
Definition: relational_expression.h:217
RelationalExpression * left
Definition: relational_expression.h:202
RelationalExpression * right
Definition: relational_expression.h:202