[MCOL-4307] View with a query containing a cartesian join silently fails Created: 2020-09-11  Updated: 2023-07-01

Status: Open
Project: MariaDB ColumnStore
Component/s: MDB Plugin
Affects Version/s: 1.4.4, 1.5.3
Fix Version/s: 23.10

Type: Task Priority: Major
Reporter: Gagan Goel (Inactive) Assignee: Denis Khalikov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MCOL-131 Cartesian product should be supported Stalled
relates to MCOL-5376 Add support for "nested loop" join.(n... Stalled

 Description   

ColumnStore does not support cartesian joins.

When a View is created on a query containing a cartesian join, instead of reporting a failure, the view executes with incorrect results. If, however, the query inside the view is executed on it's own, appropriate error is reported.

Following are steps to reproduce (these queries are taken from working_tpch1_compareLogOnly/view/mts_view.50.sql):

MariaDB [test]> create table t1 (x int, y int) engine=columnstore;
Query OK, 0 rows affected (0.334 sec)
 
MariaDB [test]> create table t2 (x int, y int, z int) engine=columnstore;
Query OK, 0 rows affected (0.342 sec)
 
MariaDB [test]> create table t3 (x int, y int, z int) engine=columnstore;
Query OK, 0 rows affected (0.334 sec)
 
MariaDB [test]> create table t4 (x int, y int, z int) engine=columnstore;
Query OK, 0 rows affected (0.402 sec)
 
MariaDB [test]> insert into t1 values (1, 1), (2, 2), (3, null);
Query OK, 3 rows affected (0.198 sec)
Records: 3  Duplicates: 0  Warnings: 0
 
MariaDB [test]> insert into t2 values (1, 1, 1), (2, 2, null), (3, null, null);
Query OK, 3 rows affected (0.199 sec)
Records: 3  Duplicates: 0  Warnings: 0
 
MariaDB [test]> insert into t3 values (1, 1, 1), (2, 2, null), (3, null, null);
Query OK, 3 rows affected (0.193 sec)
Records: 3  Duplicates: 0  Warnings: 0
 
MariaDB [test]> insert into t4 values (1, 1, 1), (2, 2, null), (3, null, null);
Query OK, 3 rows affected (0.197 sec)
Records: 3  Duplicates: 0  Warnings: 0
 
MariaDB [test]> select t1.x from ((t1 join t2 on ((t1.y = t2.y))) join (t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z)))
    -> ;
ERROR 1815 (HY000): Internal error: IDB-1000: 't1, t2' and 't3, t4' are not joined.
MariaDB [test]> create view v1 as select t1.x from ((t1 join t2 on ((t1.y = t2.y))) join (t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z)));
Query OK, 0 rows affected (0.016 sec)
 
MariaDB [test]> select * from v1;
+------+
| x    |
+------+
| NULL |
| NULL |
| NULL |
+------+
3 rows in set (0.074 sec)


Generated at Thu Feb 08 02:49:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.