MySQL 8.1.0
Source Code Documentation
opt_explain_traditional.h
Go to the documentation of this file.
1/* Copyright (c) 2011, 2023, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
24#define OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
25
26#include <assert.h>
27// assert
28#include <memory>
29#include <string>
30#include <vector>
31
34
35class Item;
36class Json_dom;
37class Json_object;
38class Query_result;
40template <class T>
41class mem_root_deque;
42
43/**
44 Formatter for the traditional EXPLAIN output
45*/
46
48 class Item_null *nil;
49 qep_row column_buffer; ///< buffer for the current output row
50
51 public:
53
54 bool is_hierarchical() const override { return false; }
55 bool send_headers(Query_result *result) override;
57 const Explain_format_flags *) override {
58 return false;
59 }
60 bool end_context(enum_parsing_context) override { return false; }
61 bool flush_entry() override;
62 qep_row *entry() override { return &column_buffer; }
63
64 private:
66};
67
69 public:
71
72 bool is_hierarchical() const override { return false; }
73 bool send_headers(Query_result *) override {
74 assert(false);
75 return true;
76 }
78 const Explain_format_flags *) override {
79 assert(false);
80 return true;
81 }
83 assert(false);
84 return true;
85 }
86 bool flush_entry() override {
87 assert(false);
88 return true;
89 }
90 qep_row *entry() override {
91 assert(false);
92 return nullptr;
93 }
94 bool is_iterator_based() const override { return true; }
95
96 /* Convert Json object to string */
97 std::string ExplainJsonToString(Json_object *json) override;
98 void ExplainPrintTreeNode(const Json_dom *json, int level,
99 std::string *explain,
100 std::vector<std::string> *tokens_for_force_subplan);
101
102 private:
104
105 void AppendChildren(const Json_dom *children, int level, std::string *explain,
106 std::vector<std::string> *tokens_for_force_subplan,
107 std::string *child_token_digest);
108 void ExplainPrintCosts(const Json_object *obj, std::string *explain);
109};
110
111#endif // OPT_EXPLAIN_FORMAT_TRADITIONAL_INCLUDED
Definition: opt_explain_format.h:450
Formatter for the traditional EXPLAIN output.
Definition: opt_explain_traditional.h:47
bool flush_entry() override
Flush TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.cc:216
qep_row column_buffer
buffer for the current output row
Definition: opt_explain_traditional.h:49
Explain_format_traditional()
Definition: opt_explain_traditional.h:52
class Item_null * nil
Definition: opt_explain_traditional.h:48
bool begin_context(enum_parsing_context, Query_expression *, const Explain_format_flags *) override
Enter a specified context.
Definition: opt_explain_traditional.h:56
qep_row * entry() override
Get a pointer to the current TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.h:62
bool is_hierarchical() const override
A hierarchical text or a plain table.
Definition: opt_explain_traditional.h:54
bool send_headers(Query_result *result) override
Send EXPLAIN header item(s) to output stream.
Definition: opt_explain_traditional.cc:87
bool push_select_type(mem_root_deque< Item * > *items)
Definition: opt_explain_traditional.cc:178
bool end_context(enum_parsing_context) override
Leave the current context.
Definition: opt_explain_traditional.h:60
Definition: opt_explain_traditional.h:68
std::string ExplainJsonToString(Json_object *json) override
Convert Json object to string.
Definition: explain_access_path.cc:1850
bool end_context(enum_parsing_context) override
Leave the current context.
Definition: opt_explain_traditional.h:82
bool send_headers(Query_result *) override
Send EXPLAIN header item(s) to output stream.
Definition: opt_explain_traditional.h:73
bool push_select_type(mem_root_deque< Item * > *items)
bool flush_entry() override
Flush TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.h:86
qep_row * entry() override
Get a pointer to the current TABLE/JOIN_TAB property set.
Definition: opt_explain_traditional.h:90
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:2086
void ExplainPrintTreeNode(const Json_dom *json, int level, std::string *explain, std::vector< std::string > *tokens_for_force_subplan)
Definition: explain_access_path.cc:1874
Explain_format_tree()=default
bool is_hierarchical() const override
A hierarchical text or a plain table.
Definition: opt_explain_traditional.h:72
void ExplainPrintCosts(const Json_object *obj, std::string *explain)
Definition: explain_access_path.cc:2030
bool is_iterator_based() const override
Whether the format closely resembles the final plan to be executed by execution iterators (See RowIte...
Definition: opt_explain_traditional.h:94
bool begin_context(enum_parsing_context, Query_expression *, const Explain_format_flags *) override
Enter a specified context.
Definition: opt_explain_traditional.h:77
Base class for structured and hierarchical EXPLAIN output formatters.
Definition: opt_explain_format.h:505
Definition: item.h:4589
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
JSON DOM abstract base class.
Definition: json_dom.h:174
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:374
This class represents a query expression (one query block or several query blocks combined with UNION...
Definition: sql_lex.h:623
Definition: query_result.h:57
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:109
Helper class for table property buffering.
Definition: opt_explain_format.h:149
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
EXPLAIN FORMAT=<format> <command>.
enum_parsing_context
Names for different query parse tree parts.
Definition: parse_tree_node_base.h:60
Definition: result.h:29