-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-33679 Spider group by handler: skip on multiple equalities
The spider group by handler is created in JOIN::make_aggr_tables_info(), by which time calls to substitute_for_best_equal_field() should have already removed all the multiple equalities (i.e. Item_equal, with MULT_EQUAL_FUNC func_type). Therefore, if there is still such items, it is deemed as an optimizer bug and should be skipped.
- Loading branch information
1 parent
9c93d41
commit 860c1ca
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
storage/spider/mysql-test/spider/bugfix/r/mdev_33679.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# MDEV-33679 spider returns parsing failure on valid left join select by translating the on expression to () | ||
# | ||
for master_1 | ||
for child2 | ||
for child3 | ||
CREATE SERVER srv FOREIGN DATA WRAPPER mysql | ||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); | ||
CREATE TABLE `t1` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) ENGINE=MYISAM; | ||
CREATE TABLE `t2` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL ) ENGINE=MYISAM; | ||
SET spider_same_server_link= on; | ||
CREATE TABLE `t1_spider` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) COMMENT='wrapper "mysql",srv "srv", table "t1"' ENGINE=SPIDER; | ||
CREATE TABLE `t2_spider` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL | ||
, PRIMARY KEY (`a`) USING BTREE | ||
) COMMENT='wrapper "mysql",srv "srv",table "t2"' ENGINE=SPIDER; | ||
INSERT INTO t1_spider VALUES(1,'oooo'); | ||
INSERT INTO t2_spider VALUES(1,1); | ||
SELECT t2_spider.a,t1_spider.c FRoM t2_spider LEFT join t1_spider ON (t2_spider.c = t1_spider.c) WHERE t2_spider.a = 1; | ||
a c | ||
1 1 | ||
Warnings: | ||
Warning 1815 Internal error: Spider group by handler: Encountered multiple equalities, likely an optimizer bug | ||
drop table t1, t2, t1_spider, t2_spider; | ||
drop server srv; | ||
for master_1 | ||
for child2 | ||
for child3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--echo # | ||
--echo # MDEV-33679 spider returns parsing failure on valid left join select by translating the on expression to () | ||
--echo # | ||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_init.inc | ||
--enable_result_log | ||
--enable_query_log | ||
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql | ||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); | ||
|
||
CREATE TABLE `t1` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) ENGINE=MYISAM; | ||
CREATE TABLE `t2` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL ) ENGINE=MYISAM; | ||
SET spider_same_server_link= on; | ||
CREATE TABLE `t1_spider` (`c` INT(10) UNSIGNED NOT NULL, `b` VARCHAR(255) NOT NULL , PRIMARY KEY (`c`) USING BTREE ) COMMENT='wrapper "mysql",srv "srv", table "t1"' ENGINE=SPIDER; | ||
CREATE TABLE `t2_spider` (`a` INT(10) UNSIGNED NOT NULL, `c` INT(10) UNSIGNED NOT NULL | ||
, PRIMARY KEY (`a`) USING BTREE | ||
) COMMENT='wrapper "mysql",srv "srv",table "t2"' ENGINE=SPIDER; | ||
INSERT INTO t1_spider VALUES(1,'oooo'); | ||
INSERT INTO t2_spider VALUES(1,1); | ||
SELECT t2_spider.a,t1_spider.c FRoM t2_spider LEFT join t1_spider ON (t2_spider.c = t1_spider.c) WHERE t2_spider.a = 1; | ||
|
||
drop table t1, t2, t1_spider, t2_spider; | ||
drop server srv; | ||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_deinit.inc | ||
--enable_result_log | ||
--enable_query_log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters