1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-4680 FROM subquery containing nested joins returns an error.

Main theme of the patch is to fix joins processing in the plugin
code. We now use SELECT_LEX::top_join_list and process the nested
joins recursively, instead of SELECT_LEX::table_list struct which
we earlier used to build the join filters. The earlier approach
did not process certain nested join ON expressions, causing certain
queries to incorrectly error out such as that described in MCOL-4680.

In addition, some legacy code is also removed.
This commit is contained in:
Gagan Goel
2021-04-23 05:18:26 -04:00
parent 71c16fcb56
commit 22c7fb7c01
6 changed files with 273 additions and 272 deletions

View File

@ -0,0 +1,29 @@
#
# FROM subquery containing nested joins returns an error
#
DROP DATABASE IF EXISTS mcol4680;
CREATE DATABASE mcol4680;
USE mcol4680;
create table t1 (a int);
insert into t1 values (1), (2), (3);
create table t2 (a int);
insert into t2 values (2);
create table t3 (a int);
create table t4 (a int);
create table t5 (a int);
select * from
(
select t1.a as col1, t2.a as col2 from
t1 left join
(
(t2 left join t3 on t2.a=t3.a) left join
(t4 left join t5 on t4.a=t5.a)
on t2.a=t4.a
)
on t1.a=t2.a
) h order by col1;
col1 col2
1 NULL
2 2
3 NULL
DROP DATABASE mcol4680;

View File

@ -0,0 +1,41 @@
--source ../include/have_columnstore.inc
--source ctype_cmp_combinations.inc
--source default_storage_engine_by_combination.inc
--echo #
--echo # FROM subquery containing nested joins returns an error
--echo #
--disable_warnings
DROP DATABASE IF EXISTS mcol4680;
--enable_warnings
CREATE DATABASE mcol4680;
USE mcol4680;
create table t1 (a int);
insert into t1 values (1), (2), (3);
create table t2 (a int);
insert into t2 values (2);
create table t3 (a int);
create table t4 (a int);
create table t5 (a int);
select * from
(
select t1.a as col1, t2.a as col2 from
t1 left join
(
(t2 left join t3 on t2.a=t3.a) left join
(t4 left join t5 on t4.a=t5.a)
on t2.a=t4.a
)
on t1.a=t2.a
) h order by col1;
DROP DATABASE mcol4680;