mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-27036: resolve duplicated key issues of JSON tracing outputs:
MDEV-27036: repeated "table" key resolve for print_explain_json MDEV-27036: duplicated keys in best_access_path MDEV-27036: Explain_aggr_filesort::print_json_members: resolve duplicated "filesort" member in Json object MDEV-27036: Explain_basic_join:: print_explain_json_interns fixed start_dups_weedout case for main.explain_json test
This commit is contained in:
committed by
Sergei Krivonos
parent
a01c82ef2e
commit
73df7a3009
@@ -25,6 +25,8 @@
|
||||
#include "opt_range.h"
|
||||
#include "sql_expression_cache.h"
|
||||
|
||||
#include <stack>
|
||||
|
||||
const char * STR_DELETING_ALL_ROWS= "Deleting all rows";
|
||||
const char * STR_IMPOSSIBLE_WHERE= "Impossible WHERE";
|
||||
const char * STR_NO_ROWS_AFTER_PRUNING= "No matching rows after partition pruning";
|
||||
@@ -41,7 +43,7 @@ static void write_item(Json_writer *writer, Item *item);
|
||||
static void append_item_to_str(String *out, Item *item);
|
||||
|
||||
Explain_query::Explain_query(THD *thd_arg, MEM_ROOT *root) :
|
||||
mem_root(root), upd_del_plan(NULL), insert_plan(NULL),
|
||||
mem_root(root), upd_del_plan(nullptr), insert_plan(nullptr),
|
||||
unions(root), selects(root), thd(thd_arg), apc_enabled(false),
|
||||
operations(0)
|
||||
{
|
||||
@@ -1062,14 +1064,13 @@ void Explain_aggr_window_funcs::print_json_members(Json_writer *writer,
|
||||
{
|
||||
Explain_aggr_filesort *srt;
|
||||
List_iterator<Explain_aggr_filesort> it(sorts);
|
||||
writer->add_member("sorts").start_object();
|
||||
Json_writer_array sorts(writer, "sorts");
|
||||
while ((srt= it++))
|
||||
{
|
||||
writer->add_member("filesort").start_object();
|
||||
Json_writer_object sort(writer);
|
||||
Json_writer_object filesort(writer, "filesort");
|
||||
srt->print_json_members(writer, is_analyze);
|
||||
writer->end_object(); // filesort
|
||||
}
|
||||
writer->end_object(); // sorts
|
||||
}
|
||||
|
||||
|
||||
@@ -1091,17 +1092,22 @@ print_explain_json_interns(Explain_query *query,
|
||||
Json_writer *writer,
|
||||
bool is_analyze)
|
||||
{
|
||||
Json_writer_nesting_guard guard(writer);
|
||||
for (uint i=0; i< n_join_tabs; i++)
|
||||
{
|
||||
if (join_tabs[i]->start_dups_weedout)
|
||||
writer->add_member("duplicates_removal").start_object();
|
||||
Json_writer_array loop(writer, "nested_loop");
|
||||
for (uint i=0; i< n_join_tabs; i++)
|
||||
{
|
||||
if (join_tabs[i]->start_dups_weedout)
|
||||
{
|
||||
writer->start_object();
|
||||
writer->add_member("duplicates_removal");
|
||||
}
|
||||
|
||||
join_tabs[i]->print_explain_json(query, writer, is_analyze);
|
||||
join_tabs[i]->print_explain_json(query, writer, is_analyze);
|
||||
|
||||
if (join_tabs[i]->end_dups_weedout)
|
||||
writer->end_object();
|
||||
}
|
||||
if (join_tabs[i]->end_dups_weedout)
|
||||
writer->end_object();
|
||||
}
|
||||
} // "nested_loop"
|
||||
print_explain_json_for_children(query, writer, is_analyze);
|
||||
}
|
||||
|
||||
@@ -1685,7 +1691,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
|
||||
Json_writer *writer,
|
||||
bool is_analyze)
|
||||
{
|
||||
Json_writer_nesting_guard guard(writer);
|
||||
Json_writer_object jsobj(writer);
|
||||
|
||||
if (pre_join_sort)
|
||||
{
|
||||
@@ -2081,14 +2087,15 @@ void Explain_quick_select::print_json(Json_writer *writer)
|
||||
}
|
||||
else
|
||||
{
|
||||
writer->add_member(get_name_by_type()).start_object();
|
||||
Json_writer_array ranges(writer, get_name_by_type());
|
||||
|
||||
List_iterator_fast<Explain_quick_select> it (children);
|
||||
Explain_quick_select* child;
|
||||
while ((child = it++))
|
||||
{
|
||||
Json_writer_object obj(writer);
|
||||
child->print_json(writer);
|
||||
|
||||
writer->end_object();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user