diff options
author | Nayuta Yanagisawa <nayuta.yanagisawa@hey.com> | 2022-01-14 15:58:38 +0900 |
---|---|---|
committer | Nayuta Yanagisawa <nayuta.yanagisawa@hey.com> | 2022-01-14 15:58:38 +0900 |
commit | 7b0c2a9980937b63ceded4ad84c670e550a086ef (patch) | |
tree | 550e5922cbc42eff010e5c573200dc59dd2bb0d1 | |
parent | 2832b949fcd06f7be7fb280df327acbae9797fe8 (diff) | |
download | mariadb-git-bb-10.4-mdev-26345.tar.gz |
Revert "MDEV-26345 SELECT MIN on Spider table returns more rows than expected"bb-10.4-mdev-26345
This reverts commit b9730226dce5bf34b87aa28963f1df68a695a93c.
-rw-r--r-- | sql/sql_select.cc | 11 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result | 42 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_26345.cnf | 3 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test | 51 | ||||
-rw-r--r-- | storage/spider/mysql-test/spider/r/direct_join.result | 2 |
5 files changed, 7 insertions, 102 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fa25cdc98ad..9311eb4fa18 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3278,12 +3278,13 @@ bool JOIN::make_aggr_tables_info() /* Check if the storage engine can intercept the query. - The query optimizer might optimize away aggregation functins or DISTINCT. - In such a cage, we need to notify a storage engine supporting a group by - handler of the existence of the original explicit or implicit grouping. - Thus, we set select_distinct || implicit_grouping to Query::distinct. + JOIN::optimize_stage2() might convert DISTINCT into GROUP BY and then + optimize away GROUP BY (group_list). In such a case, we need to notify + a storage engine supporting a group by handler of the existence of the + original DISTINCT. Thus, we set select_distinct || group_optimized_away + to Query::distinct. */ - Query query= {&all_fields, select_distinct || implicit_grouping, tables_list, + Query query= {&all_fields, select_distinct || group_optimized_away, tables_list, conds, group_list, order ? order : group_list, having}; group_by_handler *gbh= ht->create_group_by(thd, &query); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result deleted file mode 100644 index d99782d7c30..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result +++ /dev/null @@ -1,42 +0,0 @@ -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 - -MDEV-26345 SELECT MIN on Spider table returns more rows than expected - -connection child2_1; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -CREATE TABLE tbl_a ( -`a`int, -`b`int, -PRIMARY KEY (`a`, `b`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -insert into `tbl_a` VALUES (1,1), (1,2), (2,11); -connection master_1; -CREATE DATABASE auto_test_remote; -USE auto_test_remote; -CREATE TABLE tbl_a ( -`a`int, -`b`int, -PRIMARY KEY (`a`, `b`) -) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS(`b`) ( -PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' -); -connection master_1; -SELECT MIN(b), a FROM tbl_a WHERE a=1; -MIN(b) a -1 1 -connection master_1; -DROP DATABASE IF EXISTS auto_test_remote; -connection child2_1; -DROP DATABASE IF EXISTS auto_test_remote; -for master_1 -for child2 -child2_1 -child2_2 -child2_3 -for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.cnf deleted file mode 100644 index 05dfd8a0bce..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.cnf +++ /dev/null @@ -1,3 +0,0 @@ -!include include/default_mysqld.cnf -!include ../my_1_1.cnf -!include ../my_2_1.cnf diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test deleted file mode 100644 index 5ac1e0b0891..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test +++ /dev/null @@ -1,51 +0,0 @@ ---disable_warnings ---disable_query_log ---disable_result_log ---source ../../t/test_init.inc ---enable_result_log ---enable_query_log ---enable_warnings - ---echo ---echo MDEV-26345 SELECT MIN on Spider table returns more rows than expected ---echo - ---connection child2_1 -CREATE DATABASE auto_test_remote; -USE auto_test_remote; - -eval CREATE TABLE tbl_a ( - `a`int, - `b`int, - PRIMARY KEY (`a`, `b`) -) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; - -insert into `tbl_a` VALUES (1,1), (1,2), (2,11); - ---connection master_1 -CREATE DATABASE auto_test_remote; -USE auto_test_remote; - -eval CREATE TABLE tbl_a ( - `a`int, - `b`int, - PRIMARY KEY (`a`, `b`) -) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS(`b`) ( - PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' -); - ---connection master_1 -SELECT MIN(b), a FROM tbl_a WHERE a=1; - ---connection master_1 -DROP DATABASE IF EXISTS auto_test_remote; ---connection child2_1 -DROP DATABASE IF EXISTS auto_test_remote; - ---disable_warnings ---disable_query_log ---disable_result_log ---source ../../t/test_deinit.inc ---enable_result_log ---enable_query_log ---enable_warnings diff --git a/storage/spider/mysql-test/spider/r/direct_join.result b/storage/spider/mysql-test/spider/r/direct_join.result index e4fbe6407af..a1018c35fbf 100644 --- a/storage/spider/mysql-test/spider/r/direct_join.result +++ b/storage/spider/mysql-test/spider/r/direct_join.result @@ -167,7 +167,7 @@ connection child2_1; SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; argument select `id`,`hr_status`,`region_code`,`region` from `auto_test_remote`.`tbl_person` where `id` = '24FC3F0A5119432BAE13DD65AABAA39C' and `region` = 510411 -select distinct count(0) `count(0)` from `auto_test_remote`.`tbl_ncd_cm_person` t0 where ((t0.`person_id` = '24FC3F0A5119432BAE13DD65AABAA39C') and (t0.`diseaseKind_id` = '52A0328740914BCE86ED10A4D2521816')) +select count(0) `count(0)` from `auto_test_remote`.`tbl_ncd_cm_person` t0 where ((t0.`person_id` = '24FC3F0A5119432BAE13DD65AABAA39C') and (t0.`diseaseKind_id` = '52A0328740914BCE86ED10A4D2521816')) SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' SELECT * FROM tbl_person; id hr_status region_code region |