MySQL 9.1.0
Source Code Documentation
opt_explain_traditional.h
Go to the documentation of this file.
1/* Copyright (c) 2011, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
25#define OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
26
27#include <assert.h>
28// assert
29#include <memory>
30#include <string>
31#include <vector>
32
35
36class Item;
37class Json_dom;
38class Json_object;
39class Query_result;
41template <class T>
42class mem_root_deque;
43
44/**
45 Formatter for the traditional EXPLAIN output
46*/
47
49 class Item_null *nil;
50 qep_row column_buffer; ///< buffer for the current output row
51
52 public:
54
55 bool is_hierarchical() const override { return false; }
56 bool send_headers(Query_result *result) override;
58 const Explain_format_flags *) override {
59 return false;
60 }
61 bool end_context(enum_parsing_context) override { return false; }
62 bool flush_entry() override;
63 qep_row *entry() override { return &column_buffer; }
64
65 private:
67};
68
70 public:
72
73 bool is_hierarchical() const override { return false; }
74 bool send_headers(Query_result *) override {
75 assert(false);
76 return true;
77 }
79 const Explain_format_flags *) override {
80 assert(false);
81 return true;
82 }
84 assert(false);
85 return true;
86 }
87 bool flush_entry() override {
88 assert(false);
89 return true;
90 }
91 qep_row *entry() override {
92 assert(false);
93 return nullptr;
94 }
95 bool is_iterator_based(THD *explain_thd [[maybe_unused]],
96 const THD *query_thd [[maybe_unused]]) const override {
97 return true;
98 }
99
100 /* Convert Json object to string */
101 std::string ExplainJsonToString(Json_object *json) override;
102 void ExplainPrintTreeNode(const Json_dom *json, int level,
103 std::string *explain,
104 std::vector<std::string> *tokens_for_force_subplan);
105
106 private:
108
109 void AppendChildren(const Json_dom *children, int level, std::string *explain,
110 std::vector<std::string> *tokens_for_force_subplan,
111 std::string *child_token_digest);
112 void ExplainPrintCosts(const Json_object *obj, std::string *explain);
113};
114
115#endif // OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Definition: opt_explain_format.h:451
Formatter for the traditional EXPLAIN output.
Definition: opt_explain_traditional.h:48
bool flush_entry() override
Flush TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.cc:217
qep_row column_buffer
buffer for the current output row
Definition: opt_explain_traditional.h:50
Explain_format_traditional()
Definition: opt_explain_traditional.h:53
class Item_null * nil
Definition: opt_explain_traditional.h:49
bool begin_context(enum_parsing_context, Query_expression *, const Explain_format_flags *) override
Enter a specified context.
Definition: opt_explain_traditional.h:57
qep_row * entry() override
Get a pointer to the current TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.h:63
bool is_hierarchical() const override
A hierarchical text or a plain table.
Definition: opt_explain_traditional.h:55
bool send_headers(Query_result *result) override
Send EXPLAIN header item(s) to output stream.
Definition: opt_explain_traditional.cc:88
bool push_select_type(mem_root_deque< Item * > *items)
Definition: opt_explain_traditional.cc:179
bool end_context(enum_parsing_context) override
Leave the current context.
Definition: opt_explain_traditional.h:61
Definition: opt_explain_traditional.h:69
std::string ExplainJsonToString(Json_object *json) override
Convert Json object to string.
Definition: explain_access_path.cc:2219
bool end_context(enum_parsing_context) override
Leave the current context.
Definition: opt_explain_traditional.h:83
bool send_headers(Query_result *) override
Send EXPLAIN header item(s) to output stream.
Definition: opt_explain_traditional.h:74
bool push_select_type(mem_root_deque< Item * > *items)
bool flush_entry() override
Flush TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.h:87
qep_row * entry() override
Get a pointer to the current TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.h:91
void AppendChildren(const Json_dom *children, int level, std::string *explain, std::vector< std::string > *tokens_for_force_subplan, std::string *child_token_digest)
Definition: explain_access_path.cc:2339
void ExplainPrintTreeNode(const Json_dom *json, int level, std::string *explain, std::vector< std::string > *tokens_for_force_subplan)
Definition: explain_access_path.cc:2243
Explain_format_tree()=default
bool is_hierarchical() const override
A hierarchical text or a plain table.
Definition: opt_explain_traditional.h:73
void ExplainPrintCosts(const Json_object *obj, std::string *explain)
Definition: explain_access_path.cc:2282
bool is_iterator_based(THD *explain_thd, const THD *query_thd) const override
Whether the format closely resembles the final plan to be executed by execution iterators (See RowIte...
Definition: opt_explain_traditional.h:95
bool begin_context(enum_parsing_context, Query_expression *, const Explain_format_flags *) override
Enter a specified context.
Definition: opt_explain_traditional.h:78
Base class for structured and hierarchical EXPLAIN output formatters.
Definition: opt_explain_format.h:506
Definition: item.h:4735
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
JSON DOM abstract base class.
Definition: json_dom.h:172
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:367
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:627
Definition: query_result.h:58
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
Helper class for table property buffering.
Definition: opt_explain_format.h:150
EXPLAIN FORMAT=<format> <command>.
enum_parsing_context
Names for different query parse tree parts.
Definition: parse_tree_node_base.h:61
Definition: result.h:30