![]() |
MySQL 9.6.0
Source Code Documentation
|
#include <parse_tree_nodes.h>
Public Member Functions | |
| PT_group (const POS &pos, Mem_root_array_YY< PT_order_list * > group_list_arg, olap_type olap_arg) | |
| bool | do_contextualize (Parse_context *pc) override |
| bool | set_olap_type (Parse_context *pc) |
| bool | set_num_grouping_sets (Parse_context *pc, int &num_grouping_sets) |
| void | check_if_execute_only_in_secondary_engine (Parse_context *pc, int num_grouping_sets) |
| bool | allocate_grouping_sets (Parse_context *pc, int &num_grouping_sets) |
| Initializes the grouping set if the query block includes GROUP BY modifiers. More... | |
| bool | populate_grouping_sets (Parse_context *pc) |
| Populates the grouping sets if the query block includes non-primitive grouping. More... | |
| void | populate_grouping_sets_rollup_cube (Parse_context *pc) |
| Populate the grouping set bitvector if the query block has non-primitive ROLLUP and CUBE grouping. More... | |
| bool | populate_grouping_sets_fornon_primitive_grouping (Parse_context *pc) |
| Populate the grouping set bitvector if the query block has GROUPING SETS group by modifier. More... | |
Public Member Functions inherited from Parse_tree_node_tmpl< Context > | |
| virtual | ~Parse_tree_node_tmpl ()=default |
| bool | is_contextualized () const |
| void | set_contextualized () |
| virtual bool | contextualize (Context *pc) final |
| void | error (Context *pc, const POS &pos) const |
| syntax_error() function replacement for deferred reporting of syntax errors More... | |
| void | error (Context *pc, const POS &pos, const char *msg) const |
| syntax_error() function replacement for deferred reporting of syntax errors More... | |
| void | errorf (Context *pc, const POS &pos, const char *format,...) const |
| syntax_error() function replacement for deferred reporting of syntax errors More... | |
Protected Member Functions | |
| void | add_json_info (Json_object *obj) override |
| Add all the node-specific json fields. More... | |
Protected Member Functions inherited from Parse_tree_node_tmpl< Context > | |
| Parse_tree_node_tmpl ()=delete | |
| Parse_tree_node_tmpl (const POS &pos) | |
| Parse_tree_node_tmpl (const POS &start_pos, const POS &end_pos) | |
| bool | begin_parse_tree (Show_parse_tree *tree) |
| bool | end_parse_tree (Show_parse_tree *tree) |
| virtual bool | do_contextualize (Context *pc) |
| Do all context-sensitive things and mark the node as contextualized. More... | |
Private Types | |
| typedef Parse_tree_node | super |
Private Attributes | |
| Mem_root_array_YY< PT_order_list * > | group_list |
| olap_type | olap |
Additional Inherited Members | |
Public Types inherited from Parse_tree_node_tmpl< Context > | |
| typedef Context | context_t |
Static Public Member Functions inherited from Parse_tree_node_tmpl< Context > | |
| static void * | operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept |
| static void | operator delete (void *ptr, size_t size) |
| static void | operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept |
Public Attributes inherited from Parse_tree_node_tmpl< Context > | |
| POS | m_pos |
|
private |
|
inline |
|
inlineoverrideprotectedvirtual |
Add all the node-specific json fields.
Any class that needs to add such info should override this function rather than doing it in do_contextualize(). E.g. the parse tree node for AVG() may have "distinct" field to indicate if AVG(DISTINCT ...) is used or not.
| json_obj | Json object for this parse tree node. |
Reimplemented from Parse_tree_node_tmpl< Context >.
| bool PT_group::allocate_grouping_sets | ( | Parse_context * | pc, |
| int & | num_grouping_sets | ||
| ) |
Initializes the grouping set if the query block includes GROUP BY modifiers.
| void PT_group::check_if_execute_only_in_secondary_engine | ( | Parse_context * | pc, |
| int | num_grouping_sets | ||
| ) |
|
override |
| bool PT_group::populate_grouping_sets | ( | Parse_context * | pc | ) |
Populates the grouping sets if the query block includes non-primitive grouping.
Populate the grouping set bitvector if the query block has non-primitive grouping.
Group by modifiers ROLLUP, CUBE and GROUPING SETS can be represented as grouping sets, which are determined during query preparation. The representation of the grouping set is done using a bitfield in the ORDER object. case ROLLUP : Say the query has GROUP BY ROLLUP (c1,c2) then the grouping sets will be () (c1) (c1,c2). () represents implicit grouping. Here there are 3 grouping sets ranging from 0 to 2. where 0 is the implicit grouping. The bitfield associated with Group by element 'c1' will be 6 (i,e. (2^2)+(2^1)) The bitfield associated with Group by element 'c2' will be 4 (i,e. (2^2)) as it is part of only set number 2
case CUBE: Say the query has GROUP BY CUBE (c1,c2) then the grouping sets will be () (c2) (c1) (c1,c2) The bitfield associated with Group by element 'c1' will be 12 (i,e. (2^3)+(2^2)). The bitfield associated with Group by element 'c2' will be 10 (i,e. (2^3)+(2^1)).
case GROUPING SETS: Say the query has GROUP BY GROUPING SETS ((c1), (c1,c2), (), (c2)) then the grouping sets will be (c1), (c1,c2), (), (c2) The number of grouping sets will be 4. The bitfield associated with Group by element 'c1' will be 3 (i,e. (2^0)+(2^1)). The bitfield associated with Group by element 'c2' will be 10 (i,e. (2^3)+(2^1)).
| bool PT_group::populate_grouping_sets_fornon_primitive_grouping | ( | Parse_context * | pc | ) |
Populate the grouping set bitvector if the query block has GROUPING SETS group by modifier.
Populate the grouping set bitvector if the query block has non-primitive GROUPING SETS.
| void PT_group::populate_grouping_sets_rollup_cube | ( | Parse_context * | pc | ) |
Populate the grouping set bitvector if the query block has non-primitive ROLLUP and CUBE grouping.
| bool PT_group::set_num_grouping_sets | ( | Parse_context * | pc, |
| int & | num_grouping_sets | ||
| ) |
| bool PT_group::set_olap_type | ( | Parse_context * | pc | ) |
|
private |
|
private |