[MCOL-131] Cartesian product should be supported Created: 2016-06-12  Updated: 2023-12-15

Status: Stalled
Project: MariaDB ColumnStore
Component/s: N/A
Affects Version/s: None
Fix Version/s: 23.10

Type: New Feature Priority: Major
Reporter: Justin Swanhart (Inactive) Assignee: Denis Khalikov
Resolution: Unresolved Votes: 6
Labels: Compatibility

Issue Links:
Blocks
Duplicate
is duplicated by MCOL-1030 support non equality based joins and ... Closed
Relates
relates to MCOL-1620 Update with subquery treated as unsup... Closed
relates to MCOL-4307 View with a query containing a cartes... Open
Epic Link: ColumnStore Compatibility Improvements
Sprint: 2018-08, 2018-16

 Description   

mysql> create table t2_c(c1 int) engine=columnstore;
Query OK, 0 rows affected (0.41 sec)

mysql> create table t1_c(c1 int) engine=columnstore;
Query OK, 0 rows affected (0.46 sec)

mysql> select t1_c.* from t1_c join t2_c;
ERROR 1815 (HY000): Internal error: IDB-1000: 't1_c' and 't2_c' are not joined.

Needed for TPC-DS



 Comments   
Comment by Justin Swanhart (Inactive) [ 2016-06-12 ]

Happens with joins between storage engines too:
mysql> select * from t1_c;
------

c1

------

1

------
1 row in set (0.01 sec)

mysql> select * from t2_m;
------

c1

------

1
1

------
2 rows in set (0.00 sec)

mysql> select t1_c.* from t1_c join t2_m;
ERROR 1815 (HY000): Internal error: IDB-1000: 't1_c' and 't2_m' are not joined.

works if both tables are MyISAM:
mysql> select t1_m.* from t1_m join t2_m;
------

c1

------

1
1

------
2 rows in set (0.00 sec)

Comment by Andrew Hutchings (Inactive) [ 2017-11-27 ]

further test case in MCOL-1030. At the same time we should re-enable OPT_LINK_EQUAL_FIELDS when this is implemented too.

Comment by Richard Stracke [ 2018-06-11 ]

another Testcase:

 
 
CREATE TABLE `table_1` (
`id_unique` bigint(11) NOT NULL DEFAULT 0
) ENGINE=Columnstore DEFAULT CHARSET=utf8;
 
insert into table_1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14);
 
# different Type
CREATE TABLE `table_2` (
`id_unique` varchar(255) NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8;
 
INSERT INTO table_2 SELECT * FROM table_1;
 
 
 
SELECT DISTINCT(table_1.id_unique) FROM table_1 WHERE ( (table_1.id_unique IN (SELECT id_unique FROM table_2 WHERE id_unique IS NOT NULL)));
=> ERROR 1815 (HY000): Internal error: IDB-1000: 'table_1' and 'sub-query' are not joined.
 

With same datatype it works.

# same Type as table_1
CREATE TABLE `table_3` (
`id_unique` bigint(11) NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8;
 
INSERT INTO table_3 SELECT * FROM table_1;
 
 
.SELECT DISTINCT(table_1.id_unique) FROM table_1 WHERE ( (table_1.id_unique IN (SELECT id_unique FROM table_3 WHERE id_unique IS NOT NULL)));

Also with
set infinidb_vtable_mode = 0;

Comment by David Hill (Inactive) [ 2019-08-14 ]

We have another customer pushing for this fix. Its causing them issue without out and looking to moe back into using InnoDB tables more over columnstore.

Comment by suresh ramagiri [ 2020-05-20 ]

One of the customers, reported that their LEFT JOIN query using "LIKE" throwing error: IDB-1000: 't1' and 't2' are not joined

select * from t1 left join t2 on t1.v like concat("%", t2.i);

Here is the test case:
======
mysql> create table test.t1 (i varchar(3), v varchar(10)) engine columnstore;
mysql> create table test.t2 (i varchar(3), v varchar(10)) engine columnstore;
mysql> insert into test.t1 values ("1", "test1") ,("2", "test2") ,("3", "test3") ,("4", "test4"), ("5", "test5");
mysql> insert into test.t2 values ("3", "test1") ,("3", "test2") ,("2", "test3") ,("4", "test4"), ("5", "test5");

mysql> select * from t1 left join t2 on t1.v like concat("%", t2.i);
ERROR 1815 (HY000): Internal error: IDB-1000: 't1' and 't2' are not joined.
====

I could reproduce the same at CS 1.2.5 locally, so changing the infinidb_vtable_mode to 0 or 2 making the JOIN query to work, but that doesn't look to be the solution.

Comment by JiraAutomate [ 2023-12-15 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

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