diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2015-09-24 15:43:01 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2015-09-24 15:45:54 +0300 |
commit | 7016621596d4700a8cf2c228f958edf8d8932d38 (patch) | |
tree | a48162f6de7080fc1f2901355e0782fddd219a38 /mysql-test/t/explain_json.test | |
parent | 428f03c0b5cb9b0d85a7d70772dbf2b430672e83 (diff) | |
download | mariadb-git-7016621596d4700a8cf2c228f958edf8d8932d38.tar.gz |
MDEV-8829: Assertion `0' failed in Explain_table_access::tag_to_json
- Add EXPLAIN/ANALYZE FORMAT=JSON handling for a few special cases.
Diffstat (limited to 'mysql-test/t/explain_json.test')
-rw-r--r-- | mysql-test/t/explain_json.test | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/mysql-test/t/explain_json.test b/mysql-test/t/explain_json.test index 4279d3b4fb4..153d85359c9 100644 --- a/mysql-test/t/explain_json.test +++ b/mysql-test/t/explain_json.test @@ -316,3 +316,83 @@ explain format=json select a, max(b) as TOP from t2 group by a having 1=2; --echo # HAVING is absent explain format=json select a, max(b) as TOP from t2 group by a; drop table t0, t1, t2; + +--echo # +--echo # MDEV-8829: Assertion `0' failed in Explain_table_access::tag_to_json +--echo # + +--echo # Check ET_CONST_ROW_NOT_FOUND +create table t1 (i int) engine=myisam; +explain +select * from t1; +explain format=json +select * from t1; +analyze format=json +select * from t1; +drop table t1; + +--echo # Check ET_IMPOSSIBLE_ON_CONDITION +create table t1 (a int); +create table t2 (pk int primary key); + +insert into t1 values (1),(2); +insert into t2 values (1),(2); + +explain +select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; +explain format=json +select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; +--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ +analyze format=json +select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0; + +--echo # Check ET_NOT_EXISTS: +explain +select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; +explain format=json +select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; +--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ +analyze format=json +select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null; + +--echo # Check ET_DISTINCT +explain +select distinct t1.a from t1 join t2 on t2.pk=t1.a; +explain format=json +select distinct t1.a from t1 join t2 on t2.pk=t1.a; +--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ +analyze format=json +select distinct t1.a from t1 join t2 on t2.pk=t1.a; +drop table t1,t2; + +--echo # Check ET_USING_INDEX_CONDITION_BKA +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2(a int); +insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; + +create table t3(a int, b int); +insert into t3 select a,a from t1; + +create table t4(a int, b int, c int, filler char(100), key (a,b)); +insert into t4 select a,a,a, 'filler-data' from t2; + +set @tmp_optimizer_switch=@@optimizer_switch; +set @tmp_join_cache_level=@@join_cache_level; +set optimizer_switch='mrr=on'; +set join_cache_level=6; +explain +select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); +explain format=json +select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); +--replace_regex /"r_total_time_ms": [0-9]*[.]?[0-9]*/"r_total_time_ms": "REPLACED"/ +analyze format=json +select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1); +set optimizer_switch=@tmp_optimizer_switch; +set join_cache_level=@tmp_join_cache_level; + +drop table t1,t2,t3,t4; + + + |