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

MCOL-4715 Mixed inner and outer joins with "null" filter for the table which is not involved into the outer join produces wrong results.

This commit is contained in:
Denis Khalikov
2022-08-16 00:12:15 +03:00
parent a7a9ccf889
commit 59166608b1
4 changed files with 86 additions and 5 deletions

View File

@ -0,0 +1,30 @@
DROP DATABASE IF EXISTS mcol_4715;
CREATE DATABASE mcol_4715;
USE mcol_4715;
create table t1 (a int) engine=columnstore;
create table t2 (a int) engine=columnstore;
create table t3 (a int) engine=columnstore;
create table t4 (a int) engine=columnstore;
insert into t1 values (1), (2), (3), (4);
insert into t2 values (2), (3), (4);
insert into t3 values (3), (4);
insert into t4 values (4);
select * from t1 left join t2 left join t3 on t2.a=t3.a on t1.a=t3.a where t2.a is null order by t1.a;
a a a
1 NULL NULL
2 NULL NULL
select * from t2 inner join t3 on t2.a = t3.a right join t1 on t1.a = t3.a where t2.a is null order by t1.a;
a a a
NULL NULL 1
NULL NULL 2
select * from t1 left join t2 on t1.a=t2.a left join t3 left join t4 on t3.a=t4.a on t1.a=t4.a where t3.a is null order by t1.a;
a a a a
1 NULL NULL NULL
2 2 NULL NULL
3 3 NULL NULL
select * from t1 left join t2 on t1.a=t2.a left join t3 left join t4 on t3.a=t4.a on t2.a=t4.a where t3.a is null order by t1.a;
a a a a
1 NULL NULL NULL
2 2 NULL NULL
3 3 NULL NULL
DROP DATABASE mcol_4715;

View File

@ -0,0 +1,28 @@
#
# Mixed inner and outer joins with "null filter" for the table which is not involved into the outer join produces wrong results.
#
-- source ../include/have_columnstore.inc
--disable_warnings
DROP DATABASE IF EXISTS mcol_4715;
--enable_warnings
CREATE DATABASE mcol_4715;
USE mcol_4715;
create table t1 (a int) engine=columnstore;
create table t2 (a int) engine=columnstore;
create table t3 (a int) engine=columnstore;
create table t4 (a int) engine=columnstore;
insert into t1 values (1), (2), (3), (4);
insert into t2 values (2), (3), (4);
insert into t3 values (3), (4);
insert into t4 values (4);
select * from t1 left join t2 left join t3 on t2.a=t3.a on t1.a=t3.a where t2.a is null order by t1.a;
select * from t2 inner join t3 on t2.a = t3.a right join t1 on t1.a = t3.a where t2.a is null order by t1.a;
select * from t1 left join t2 on t1.a=t2.a left join t3 left join t4 on t3.a=t4.a on t1.a=t4.a where t3.a is null order by t1.a;
select * from t1 left join t2 on t1.a=t2.a left join t3 left join t4 on t3.a=t4.a on t2.a=t4.a where t3.a is null order by t1.a;
DROP DATABASE mcol_4715;