diff options
author | Sergei Krivonos <sergei.krivonos@mariadb.com> | 2021-12-08 17:16:34 +0200 |
---|---|---|
committer | Sergei Krivonos <sergei.krivonos@mariadb.com> | 2021-12-09 03:53:36 +0200 |
commit | b0161776d91fd22198b3bf0c25dc7d1f90027dd6 (patch) | |
tree | 8d9b6d5025fbb9b8ce2634f6731f2af292cc0950 | |
parent | 1e8bcbd0a0bfa07052e9458830672ea215c8664a (diff) | |
download | mariadb-git-bb-10.8-MDEV-27204.tar.gz |
MDEV-27204: fixed Explain_basic_join::print_explain_json_interns "duplicates_removal" arraysbb-10.8-MDEV-27204
-rw-r--r-- | mysql-test/main/explain_json.result | 102 | ||||
-rw-r--r-- | mysql-test/main/explain_json.test | 8 | ||||
-rw-r--r-- | sql/sql_explain.cc | 4 |
3 files changed, 101 insertions, 13 deletions
diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result index 35f2d11c8b6..a16c20c722e 100644 --- a/mysql-test/main/explain_json.result +++ b/mysql-test/main/explain_json.result @@ -842,20 +842,22 @@ EXPLAIN } }, { - "duplicates_removal": { - "block-nl-join": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 10, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "206", - "join_type": "BNL", - "attached_condition": "t1.b = t2.b and t1.a = t2.a" + "duplicates_removal": [ + { + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "206", + "join_type": "BNL", + "attached_condition": "t1.b = t2.b and t1.a = t2.a" + } } - } + ] } ] } @@ -1941,3 +1943,77 @@ EXPLAIN } } drop table t1; +# +# MDEV-27204: [ERROR] Json_writer: a member name was expected, Assertion `got_name == named_item_expected()' failed +# +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); +ANALYZE FORMAT=JSON SELECT * FROM t t1 WHERE t1.a IN (SELECT t2.a FROM t t2 WHERE t1.a IN (SELECT t3.a FROM t t3)); +ANALYZE +{ + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": 0.232912336, + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": 0.006411025, + "r_other_time_ms": 0.008193918, + "filtered": 100, + "r_filtered": 100 + } + }, + { + "duplicates_removal": [ + { + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": 0.002642007, + "r_other_time_ms": 0.008905227, + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "152", + "join_type": "BNL", + "attached_condition": "t2.a = t1.a", + "r_filtered": 50 + } + }, + { + "block-nl-join": { + "table": { + "table_name": "t3", + "access_type": "ALL", + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": 0.001986124, + "r_other_time_ms": 0.027962783, + "filtered": 100, + "r_filtered": 100 + }, + "buffer_type": "incremental", + "buffer_size": "109", + "join_type": "BNL", + "attached_condition": "t3.a = t1.a", + "r_filtered": 50 + } + } + ] + } + ] + } +} +DROP TABLE t; diff --git a/mysql-test/main/explain_json.test b/mysql-test/main/explain_json.test index cfbc0cfa10c..8c96fb07107 100644 --- a/mysql-test/main/explain_json.test +++ b/mysql-test/main/explain_json.test @@ -419,3 +419,11 @@ explain format=json select * from t1 order by a desc, b desc; explain format=json select * from t1 order by a desc, b ; drop table t1; +--echo # +--echo # MDEV-27204: [ERROR] Json_writer: a member name was expected, Assertion `got_name == named_item_expected()' failed +--echo # + +CREATE TABLE t (a INT); +INSERT INTO t VALUES (1),(2); +ANALYZE FORMAT=JSON SELECT * FROM t t1 WHERE t1.a IN (SELECT t2.a FROM t t2 WHERE t1.a IN (SELECT t3.a FROM t t3)); +DROP TABLE t; diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 44654dc2e3d..4fd4e6d3b77 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -1100,12 +1100,16 @@ print_explain_json_interns(Explain_query *query, { writer->start_object(); writer->add_member("duplicates_removal"); + writer->start_array(); } join_tabs[i]->print_explain_json(query, writer, is_analyze); if (join_tabs[i]->end_dups_weedout) + { + writer->end_array(); writer->end_object(); + } } } // "nested_loop" print_explain_json_for_children(query, writer, is_analyze); |