diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc index 2c82f2b8d192..f4d6b3adb55a 100644 --- a/mysql-test/include/index_merge2.inc +++ b/mysql-test/include/index_merge2.inc @@ -154,16 +154,22 @@ analyze table t2; -- enable_result_log -- enable_query_log +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_regex $elide_costs explain select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; +} select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_regex $elide_costs explain select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; +} select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; @@ -378,9 +384,12 @@ analyze table t1; -- enable_result_log -- enable_query_log +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ # to test the bug, the following must use "sort_union": --replace_regex $elide_costs explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); +} select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); drop table t1; diff --git a/mysql-test/include/index_merge_ror.inc b/mysql-test/include/index_merge_ror.inc index ed319f3135f2..5c2e4d8b3907 100644 --- a/mysql-test/include/index_merge_ror.inc +++ b/mysql-test/include/index_merge_ror.inc @@ -133,6 +133,8 @@ analyze table t1; --replace_regex $elide_costs_and_rows explain select key1,key2 from t1 where key1=100 and key2=100; select key1,key2 from t1 where key1=100 and key2=100; +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; @@ -141,6 +143,8 @@ explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 o --replace_result key2 key1 key4 key3 --replace_regex /(_rows": )[0-9.]+/\1"#"/ /(_cost": )[\"]*[0-9.]+[\"]*/\1"#"/ explain format=json select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; +} + select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; --echo # Several-rows results @@ -154,38 +158,57 @@ analyze table t1; -- enable_query_log --echo # ROR-intersection, not covering +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ + --replace_result key2 key1 --replace_regex $elide_costs_and_rows explain select key1,key2,filler1 from t1 where key1=100 and key2=100; +} select key1,key2,filler1 from t1 where key1=100 and key2=100; --echo # ROR-intersection, covering +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 --replace_regex $elide_costs_and_rows explain select key1,key2 from t1 where key1=100 and key2=100; +} select key1,key2 from t1 where key1=100 and key2=100; --echo # ROR-union of ROR-intersections +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100; +} select key1,key2,key3,key4 from t1 where key1=100 and key2=100 or key3=100 and key4=100; +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; +} select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; --echo # 3-way ROR-intersection +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key3 key1 --replace_regex $elide_costs_and_rows explain select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100; +} select key1,key2,key3 from t1 where key1=100 and key2=100 and key3=100; --echo # ROR-union(ROR-intersection, ROR-range) insert into t1 (key1,key2,key3,key4,filler1) values (101,101,101,101, 'key1234-101'); +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101; +} select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=101; --echo # Run some ROR updates/deletes @@ -202,9 +225,12 @@ select key1,key2,filler1 from t1 where key2=100 and key2=200; --echo # ROR-union(ROR-intersection) with one of ROR-intersection giving empty --echo # results +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; +} select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; delete from t1 where key3=100 and key4=100; @@ -218,15 +244,21 @@ analyze table t1; --echo # ROR-union with all ROR-intersections giving empty results # The relative order of keys inside # "Using union(intersect(keyx,keyx),...)" doesn't matter +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; select key1,key2,key3,key4,filler1 from t1 where key1=100 and key2=100 or key3=100 and key4=100; +} --echo # ROR-intersection with empty result +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2 from t1 where key1=100 and key2=100; +} select key1,key2 from t1 where key1=100 and key2=100; --echo # ROR-union tests with various cases. @@ -241,9 +273,12 @@ analyze table t1; -- enable_result_log -- enable_query_log +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; +} select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, -1, 200,'key4'); @@ -254,9 +289,12 @@ analyze table t1; -- enable_result_log -- enable_query_log ---replace_result key2 key1 key4 key3 +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ + --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; +} select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; insert into t1 (key1, key2, key3, key4, filler1) values (-1, -1, 200, -1,'key3'); @@ -267,9 +305,12 @@ analyze table t1; -- enable_result_log -- enable_query_log +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ --replace_result key2 key1 key4 key3 --replace_regex $elide_costs_and_rows explain select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; +} select key1,key2,key3,key4,filler1 from t1 where key3=200 or (key1=100 and key2=100) or key4=200; --echo ## @@ -288,12 +329,21 @@ if ($engine_type != "InnoDB" ) --echo # Do many tests --echo # Check that keys that don't improve selectivity are skipped. # - +if (!$skip_ror_EXPLAIN_for_MyRocks) +{ # Different value on 32 and 64 bit +if ($random_rows_in_EXPLAIN) +{ + --replace_column 9 # +} --replace_regex $elide_costs_and_rows --replace_result sta_swt12a sta_swt21a sta_swt12a, sta_swt12a, explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1; +if ($random_rows_in_EXPLAIN) +{ + --replace_column 9 # +} --replace_regex $elide_costs_and_rows explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1; @@ -327,6 +377,7 @@ explain select st_a from t1 --replace_regex $elide_costs_and_rows explain select st_a from t1 where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1; +} drop table t0,t1;