Details
Description
create table ten(a int); insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table twenty (a int, filler char(200), key(a)); insert into twenty select A.a + B.a* 10, 'AAAAAAAAAAAAAAAAAAAA' from ten A, ten B where B.a in (0,1);
explain format=json select distinct A.a from ten A, twenty B where A.a+B.a> 0;
Crashes like this:
#0 0x00007ffff63b3425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff63b6b8b in __GI_abort () at abort.c:91 #2 0x00007ffff63ac0ee in __assert_fail_base (fmt=<optimized out>, assertion=0x11010c0 "0", file=0x1101218 "/home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_explain.cc", line=<optimized out>, function=<optimized out>) at assert.c:94 #3 0x00007ffff63ac192 in __GI___assert_fail (assertion=0x11010c0 "0", file=0x1101218 "/home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_explain.cc", line=1304, function=0x1101ca0 "void Explain_table_access::tag_to_json(Json_writer*, explain_extra_tag)") at assert.c:103 #4 0x00000000007e31cf in Explain_table_access::tag_to_json (this=0x7fff940099f8, writer=0x7ffff016f010, tag=ET_DISTINCT) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_explain.cc:1304 #5 0x00000000007e3b20 in Explain_table_access::print_explain_json (this=0x7fff940099f8, query=0x7fff940091b0, writer=0x7ffff016f010, is_analyze=false, fs_tracker=0x0) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_explain.cc:1491 #6 0x00000000007e1e2f in Explain_basic_join::print_explain_json_interns (this=0x7fff94009320, query=0x7fff940091b0, writer=0x7ffff016f010, is_analyze=false, first_table_sort=0x0) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_explain.cc:887 #7 0x00000000007e1cb4 in Explain_select::print_explain_json (this=0x7fff94009320, query=0x7fff940091b0, writer=0x7ffff016f010, is_analyze=false) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_explain.cc:850 #8 0x00000000007dfd8e in Explain_query::print_explain_json (this=0x7fff940091b0, output=0x7fff94006850, is_analyze=false) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_explain.cc:221 #9 0x0000000000688a7a in execute_sqlcom_select (thd=0x306cb50, all_tables=0x7fff94005648) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_parse.cc:5733 #10 0x000000000067f102 in mysql_execute_command (thd=0x306cb50) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_parse.cc:2926 #11 0x000000000068c377 in mysql_parse (thd=0x306cb50, rawbuf=0x7fff940053c8 "explain format=json select distinct A.a from ten A, twenty B where A.a+B.a> 0", length=77, parser_state=0x7ffff01700c0) at /home/psergey/dev-git/10.1-explain-analyze-cp/sql/sql_parse.cc:7165
Tabular EXPLAIN output:
+------+-------------+-------+-------+---------------+------+---------+------+------+------------------------------------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +------+-------------+-------+-------+---------------+------+---------+------+------+------------------------------------------------------------------------+ | 1 | SIMPLE | A | ALL | NULL | NULL | NULL | NULL | 10 | Using temporary | | 1 | SIMPLE | B | index | NULL | a | 5 | NULL | 20 | Using where; Using index; Distinct; Using join buffer (flat, BNL join) | +------+-------------+-------+-------+---------------+------+---------+------+------+------------------------------------------------------------------------+
This output is incorrect (this is an error from MySQL, see http://bugs.mysql.com/bug.php?id=76679)
But still, MariaDB should not crash.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
For the record, MySQL' EXPLAIN FORMAT=JSON (note the "distinct": true):
MySQL [test]> explain format=json select distinct A.a from ten A, twenty B where A.a+B.a> 0\GF *************************** 1. row *************************** EXPLAIN: { "query_block": { "select_id": 1, "duplicates_removal": { "using_temporary_table": true, "using_filesort": false, "nested_loop": [ { "table": { "table_name": "A", "access_type": "ALL", "rows": 10, "filtered": 100 } }, { "table": { "table_name": "B", "access_type": "index", "key": "a", "used_key_parts": [ "a" ], "key_length": "5", "rows": 20, "filtered": 100, "using_index": true, "distinct": true, "using_join_buffer": "Block Nested Loop", "attached_condition": "((`test`.`A`.`a` + `test`.`B`.`a`) > 0)" } } ] } } }