![]() |
MySQL 8.0.40
Source Code Documentation
|
A <query primary> which is a parenthesized query expression (aka qe) body with order by clause and/or limit/offset clause and the qe body is not a binary set operation (union, except, intersect), but is viewed here as a degenerate set operation; i.e. More...
#include <query_term.h>
Public Member Functions | |
Query_term_unary (MEM_ROOT *mem_root, Query_term *t) | |
Constructor. More... | |
Query_term_type | term_type () const override |
Get the node tree type. More... | |
const char * | operator_string () const override |
Get the node type description. More... | |
void | debugPrint (int level, std::ostringstream &buf) const override |
Print the tree rooted at this node to buf. More... | |
![]() | |
Query_block * | query_block () const override |
Getter for m_block, q.v. More... | |
bool | set_block (Query_block *b) |
Setter for m_block, q.v. More... | |
void | label_children () override |
Set the correct value of Query_term::m_sibling_idx recursively for set operations. More... | |
size_t | child_count () const override |
Get the number of children this node has. More... | |
bool | open_result_tables (THD *thd, int level) override |
Open tmp tables for the tree of set operation query results, by recursing. More... | |
void | cleanup (bool full) override |
Reset resources used. More... | |
void | destroy_tree () override |
Destroy the query term tree structure. More... | |
bool | has_mixed_distinct_operators () |
Check if this set operation has a mix of DISTINCT and ALL. More... | |
bool | is_unary () const |
Check if this term is a unary set operation. More... | |
Mem_root_array< MaterializePathParameters::QueryBlock > | setup_materialize_set_op (THD *thd, TABLE *dst_table, bool union_distinct_only, bool calc_found_rows) |
Sets up each(*) query block in this query expression for materialization into the given table by making a materialization parameter for each block (*) modulo union_distinct_only. More... | |
![]() | |
Query_term * | pushdown_limit_order_by (Query_term_set_op *parent=nullptr) |
Called after contextualization to simplify query, c.f. More... | |
bool | validate_structure (const Query_term *parent, int depth=0) const |
Return true if structure is too deep, i.e. More... | |
std::pair< bool, bool > | redundant_order_by (Query_block *block, int level) |
Determine if we have a redundant ORDER BY in block. More... | |
virtual | ~Query_term ()=default |
Node destructor. More... | |
Query_term_set_op * | parent () const |
Getter for m_parent, q.v. More... | |
void | set_sibling_idx (uint idx) |
Setter for m_sibling_idx , q.v. More... | |
uint | sibling_idx () |
Getter for m_sibling_idx , q.v. More... | |
void | printPointers (std::ostringstream &buf) const |
Print the pointer of this node and its parent to buf. More... | |
void | set_setop_query_result (Query_result *rs) |
Setter for m_setop_query_result, q.v. More... | |
Query_result * | setop_query_result () |
Getter for m_setop_query_result, q.v. More... | |
Query_result_union * | setop_query_result_union () |
Getter for m_setop_query_result, q.v. Use only if we can down cast. More... | |
void | cleanup_query_result (bool full) |
Cleanup m_setop_query_result, q.v. More... | |
void | set_owning_operand () |
Setter for m_owning_operand, q.v. More... | |
bool | owning_operand () |
Getter for m_owning_operand, q.v. More... | |
void | set_result_table (Table_ref *tl) |
Setter for m_result_table, q.v. More... | |
Table_ref & | result_table () |
Getter for m_result_table, q.v. More... | |
void | set_fields (mem_root_deque< Item * > *fields) |
mem_root_deque< Item * > * | fields () |
Additional Inherited Members | |
![]() | |
static void | indent (int level, std::ostringstream &buf) |
Print blank space indentation (unit: two) to buf according to level. More... | |
static void | print_order (const THD *thd, String *str, ORDER *ord, enum_query_type query_type) |
Print into str the order indicated in ord, using standard print_for_order Used by traditional explain. More... | |
![]() | |
mem_root_deque< Query_term * > | m_children |
Tree structure. More... | |
int64_t | m_last_distinct |
Index of last query expression which has <set-op> DISTINCT on its left. More... | |
int64_t | m_first_distinct |
Presently only needed by EXCEPT set operator: the index of the first DISTINCT set operand: minimum legal value is 1. More... | |
bool | m_is_materialized {true} |
true if the result of this set operation is materialized. More... | |
![]() | |
Query_term_set_op (MEM_ROOT *mem_root) | |
void | print (int level, std::ostringstream &buf, const char *type) const |
Common printing minion for set operations. More... | |
![]() | |
Query_term_set_op * | m_parent {nullptr} |
Back pointer to the node whose child we are, or nullptr (root term). More... | |
uint | m_sibling_idx {0} |
If parent is non-null, this holds the index of the current sibling. More... | |
Query_result * | m_setop_query_result {nullptr} |
The query result for this term. More... | |
bool | m_owning_operand {false} |
The operand of a n-ary set operation (that owns the common query result) has this set to true. More... | |
Table_ref * | m_result_table {nullptr} |
Result temporary table for the set operation, if applicable. More... | |
mem_root_deque< Item * > * | m_fields {nullptr} |
Used only when streaming, i.e. More... | |
A <query primary> which is a parenthesized query expression (aka qe) body with order by clause and/or limit/offset clause and the qe body is not a binary set operation (union, except, intersect), but is viewed here as a degenerate set operation; i.e.
a "unary".
/// Example: (SELECT * FROM .. ORDER BY .. LIMIT n) ORDER BY .. LIMIT m /// Tree: /// Query_expression /// | m_query_term /// Query_term_unary /// +--------------------+ /// | m_block ------+----> Query_block which holds outer /// | : | ORDER BY and LIMIT /// | m_children[0] | /// +--------|-----------+ /// V /// Query_block holds inner SELECT and its ORDER BY/LIMIT ///
One extra Query_term_unary is added for each level of nesting with the top one representing the outermost ORDER BY/LIMIT/OFFSET
|
inline |
Constructor.
mem_root | the mem_root to use for allocation |
t | the child term |
|
overridevirtual |
Print the tree rooted at this node to buf.
Call on top level with level==0
level | level we are at in tree. |
buf | the buffer to format output into |
Implements Query_term.
|
inlineoverridevirtual |
|
inlineoverridevirtual |