From 4e9ec4c2ea2534127b08f435a973b733622802f3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 10 Jun 2025 09:12:33 +0200 Subject: [PATCH] move notembedded part of the test to _notembedded --- mysql-test/suite/vcol/r/order_by_subst.result | 41 ------------- .../vcol/r/order_by_subst_notembed.result | 59 +++++++++++++++++++ mysql-test/suite/vcol/t/order_by_subst.test | 19 ------ .../suite/vcol/t/order_by_subst_notembed.test | 44 ++++++++++++++ 4 files changed, 103 insertions(+), 60 deletions(-) create mode 100644 mysql-test/suite/vcol/r/order_by_subst_notembed.result create mode 100644 mysql-test/suite/vcol/t/order_by_subst_notembed.test diff --git a/mysql-test/suite/vcol/r/order_by_subst.result b/mysql-test/suite/vcol/r/order_by_subst.result index 4edf04fbbfe..58c4a1cdca1 100644 --- a/mysql-test/suite/vcol/r/order_by_subst.result +++ b/mysql-test/suite/vcol/r/order_by_subst.result @@ -42,24 +42,6 @@ id select_type table type possible_keys key key_len ref rows Extra explain select c + 1 from t order by vc limit 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t index NULL vc 5 NULL 2 -set @old_optimizer_trace=@@optimizer_trace; -set optimizer_trace=1; -explain select c + 1 from t order by c + 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t index NULL c 5 NULL 10000 Using index; Using filesort -select -json_detailed(json_extract(trace, '$**.virtual_column_substitution')) -from -information_schema.optimizer_trace; -json_detailed(json_extract(trace, '$**.virtual_column_substitution')) -[ - { - "location": "ORDER BY", - "from": "t.c + 1", - "to": "t.vc" - } -] -set optimizer_trace=@old_optimizer_trace; drop table t; create table t (c int, key (c)); insert into t select seq from seq_1_to_10000; @@ -108,27 +90,4 @@ add index(vc1); alter table t add column vc2 int as (1 - c), add index(vc2); -set @old_optimizer_trace=@@optimizer_trace; -set optimizer_trace=1; -explain select * from t order by c + 1, 1 - c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t index NULL c 5 NULL 10000 Using index; Using filesort -select -json_detailed(json_extract(trace, '$**.virtual_column_substitution')) -from -information_schema.optimizer_trace; -json_detailed(json_extract(trace, '$**.virtual_column_substitution')) -[ - { - "location": "ORDER BY", - "from": "t.c + 1", - "to": "t.vc1" - }, - { - "location": "ORDER BY", - "from": "1 - t.c", - "to": "t.vc2" - } -] -set optimizer_trace=@old_optimizer_trace; drop table t; diff --git a/mysql-test/suite/vcol/r/order_by_subst_notembed.result b/mysql-test/suite/vcol/r/order_by_subst_notembed.result new file mode 100644 index 00000000000..a5482dbd9bf --- /dev/null +++ b/mysql-test/suite/vcol/r/order_by_subst_notembed.result @@ -0,0 +1,59 @@ +# +# MDEV-36132 Optimizer support for functional indexes: handle GROUP/ORDER BY +# +create table t (c int, key (c)); +insert into t select seq from seq_1_to_10000; +alter table t +add column vc int as (c + 1), +add index(vc); +set @old_optimizer_trace=@@optimizer_trace; +set optimizer_trace=1; +explain select c + 1 from t order by c + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index NULL c 5 NULL 10000 Using index; Using filesort +select +json_detailed(json_extract(trace, '$**.virtual_column_substitution')) +from +information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.virtual_column_substitution')) +[ + { + "location": "ORDER BY", + "from": "t.c + 1", + "to": "t.vc" + } +] +set optimizer_trace=@old_optimizer_trace; +drop table t; +create table t (c int, key (c)); +insert into t select seq from seq_1_to_10000; +alter table t +add column vc1 int as (c + 1), +add index(vc1); +alter table t +add column vc2 int as (1 - c), +add index(vc2); +set @old_optimizer_trace=@@optimizer_trace; +set optimizer_trace=1; +explain select * from t order by c + 1, 1 - c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index NULL c 5 NULL 10000 Using index; Using filesort +select +json_detailed(json_extract(trace, '$**.virtual_column_substitution')) +from +information_schema.optimizer_trace; +json_detailed(json_extract(trace, '$**.virtual_column_substitution')) +[ + { + "location": "ORDER BY", + "from": "t.c + 1", + "to": "t.vc1" + }, + { + "location": "ORDER BY", + "from": "1 - t.c", + "to": "t.vc2" + } +] +set optimizer_trace=@old_optimizer_trace; +drop table t; diff --git a/mysql-test/suite/vcol/t/order_by_subst.test b/mysql-test/suite/vcol/t/order_by_subst.test index fcb557382ee..d901e506f4a 100644 --- a/mysql-test/suite/vcol/t/order_by_subst.test +++ b/mysql-test/suite/vcol/t/order_by_subst.test @@ -26,17 +26,6 @@ explain select vc from t order by c + 1 limit 2; explain select c + 1 from t order by c + 1 limit 2; explain select c + 1 from t order by vc limit 2; -## optimizer trace - -set @old_optimizer_trace=@@optimizer_trace; -set optimizer_trace=1; -explain select c + 1 from t order by c + 1; -select -json_detailed(json_extract(trace, '$**.virtual_column_substitution')) -from -information_schema.optimizer_trace; -set optimizer_trace=@old_optimizer_trace; - drop table t; # vcol on vcol @@ -84,12 +73,4 @@ alter table t alter table t add column vc2 int as (1 - c), add index(vc2); -set @old_optimizer_trace=@@optimizer_trace; -set optimizer_trace=1; -explain select * from t order by c + 1, 1 - c; -select -json_detailed(json_extract(trace, '$**.virtual_column_substitution')) -from -information_schema.optimizer_trace; -set optimizer_trace=@old_optimizer_trace; drop table t; diff --git a/mysql-test/suite/vcol/t/order_by_subst_notembed.test b/mysql-test/suite/vcol/t/order_by_subst_notembed.test new file mode 100644 index 00000000000..f488e73dc51 --- /dev/null +++ b/mysql-test/suite/vcol/t/order_by_subst_notembed.test @@ -0,0 +1,44 @@ +--echo # +--echo # MDEV-36132 Optimizer support for functional indexes: handle GROUP/ORDER BY +--echo # + +--source include/not_embedded.inc +--source include/have_sequence.inc +create table t (c int, key (c)); +insert into t select seq from seq_1_to_10000; +alter table t + add column vc int as (c + 1), + add index(vc); + +## optimizer trace + +set @old_optimizer_trace=@@optimizer_trace; +set optimizer_trace=1; +explain select c + 1 from t order by c + 1; +select +json_detailed(json_extract(trace, '$**.virtual_column_substitution')) +from +information_schema.optimizer_trace; +set optimizer_trace=@old_optimizer_trace; + +drop table t; + +# multiple items in order by + +create table t (c int, key (c)); +insert into t select seq from seq_1_to_10000; +alter table t + add column vc1 int as (c + 1), + add index(vc1); +alter table t + add column vc2 int as (1 - c), + add index(vc2); +set @old_optimizer_trace=@@optimizer_trace; +set optimizer_trace=1; +explain select * from t order by c + 1, 1 - c; +select +json_detailed(json_extract(trace, '$**.virtual_column_substitution')) +from +information_schema.optimizer_trace; +set optimizer_trace=@old_optimizer_trace; +drop table t;