Commit c88e37ff authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-27204: [ERROR] Json_writer: a member name was expected, Assertion `got_name

[Adjusting Sergei Krivonos's patch]

"duplicates_removal" may contain multiple elements inside it and
so should have a JSON array as a value (and not object).
parent 1e8bcbd0
...@@ -842,20 +842,22 @@ EXPLAIN ...@@ -842,20 +842,22 @@ EXPLAIN
} }
}, },
{ {
"duplicates_removal": { "duplicates_removal": [
"block-nl-join": { {
"table": { "block-nl-join": {
"table_name": "t1", "table": {
"access_type": "ALL", "table_name": "t1",
"rows": 10, "access_type": "ALL",
"filtered": 100 "rows": 10,
}, "filtered": 100
"buffer_type": "flat", },
"buffer_size": "206", "buffer_type": "flat",
"join_type": "BNL", "buffer_size": "206",
"attached_condition": "t1.b = t2.b and t1.a = t2.a" "join_type": "BNL",
"attached_condition": "t1.b = t2.b and t1.a = t2.a"
}
} }
} ]
} }
] ]
} }
...@@ -1941,3 +1943,60 @@ EXPLAIN ...@@ -1941,3 +1943,60 @@ EXPLAIN
} }
} }
drop table t1; drop table t1;
#
# MDEV-27204: [ERROR] Json_writer: a member name was expected, Assertion `got_name == named_item_expected()' failed
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
explain FORMAT=JSON
SELECT * FROM t1 t0
WHERE t0.a IN (SELECT t2.a FROM t1 t2 WHERE t0.a IN (SELECT t3.a FROM t1 t3));
EXPLAIN
{
"query_block": {
"select_id": 1,
"nested_loop": [
{
"table": {
"table_name": "t0",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
},
{
"duplicates_removal": [
{
"block-nl-join": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "152",
"join_type": "BNL",
"attached_condition": "t2.a = t0.a"
}
},
{
"block-nl-join": {
"table": {
"table_name": "t3",
"access_type": "ALL",
"rows": 2,
"filtered": 100
},
"buffer_type": "incremental",
"buffer_size": "109",
"join_type": "BNL",
"attached_condition": "t3.a = t0.a"
}
}
]
}
]
}
}
DROP TABLE t1;
...@@ -419,3 +419,13 @@ explain format=json select * from t1 order by a desc, b desc; ...@@ -419,3 +419,13 @@ explain format=json select * from t1 order by a desc, b desc;
explain format=json select * from t1 order by a desc, b ; explain format=json select * from t1 order by a desc, b ;
drop table t1; 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 t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
explain FORMAT=JSON
SELECT * FROM t1 t0
WHERE t0.a IN (SELECT t2.a FROM t1 t2 WHERE t0.a IN (SELECT t3.a FROM t1 t3));
DROP TABLE t1;
...@@ -1100,12 +1100,16 @@ print_explain_json_interns(Explain_query *query, ...@@ -1100,12 +1100,16 @@ print_explain_json_interns(Explain_query *query,
{ {
writer->start_object(); writer->start_object();
writer->add_member("duplicates_removal"); writer->add_member("duplicates_removal");
writer->start_array();
} }
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) if (join_tabs[i]->end_dups_weedout)
{
writer->end_array();
writer->end_object(); writer->end_object();
}
} }
} // "nested_loop" } // "nested_loop"
print_explain_json_for_children(query, writer, is_analyze); print_explain_json_for_children(query, writer, is_analyze);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment