[MCOL-4250] Correlated Subquery, particularly inside and OUTER JOIN ON clause, is currently not supported Created: 2020-08-18 Updated: 2024-01-18 |
|
| Status: | Confirmed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 1.2.5, 1.5.3, 23.10.0 |
| Fix Version/s: | 23.10 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Allen Lee (Inactive) | Assignee: | Denis Khalikov |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | Compatibility | ||
| Environment: |
10.5.4-2 mariadb enterprise server |
||
| Epic Link: | ColumnStore Compatibility Improvements |
| Description |
|
running select query against view return the following error.
I was able to reproduce this with the following sample tables.
|
| Comments |
| Comment by Gregory Dorman (Inactive) [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
allen.lee@mariadb.com Allen - can you try to change the query slightly? And then, if it works, run the original on InnoDB and the one below on columnstore and compare the results to make sure they return identical results. CREATE VIEW `vw_triggerevent_assoc_bcap_cases` Background. The simplest reproduction is as follows: MariaDB [(none)]> create database gjd; MariaDB [(none)]> use gjd; MariaDB [gjd]> insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000); MariaDB [gjd]> select * from t1 q1 left join t1 q2 on q1.a = (select a from t1 limit 1);
-----
----- A little more complex but closer to the original: MariaDB [gjd]> drop database gjd; MariaDB [(none)]> create database gjd; MariaDB [(none)]> use gjd; MariaDB [gjd]> insert into t1 values (1,10,100,1000),(1,10,100,2000),(1,10,100,3000); MariaDB [gjd]> select * from t1 q1 left join t1 q2 on q1.a=q2.a and q1.b=q2.b and q1.c=q2.c and q2.d = (select max(d) from t1 q3 where q1.a=q3.a and q1.b=q3.b and q1.c=q3.c);
-----
----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Gregory Dorman (Inactive) [ 2020-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
drrtuy - this is less horrific than what we thought. We can do correlated subqueries and use them in join clauses, just not with outer joins. Probably is "just a bug", in this particular case. Does not make what we discussed untrue. And - if DBS accepts workaround, assuming it is confirmed as producing the right results, it wouldn't be a high priority for now, at least in my opinion. MariaDB [gjd]> create table t1 (a int, b int, c int, d int) engine=columnstore; MariaDB [gjd]> insert into t1 values (1,10,100,1000),(2,20,200,2000),(3,30,300,3000); MariaDB [gjd]> select * from t1 q1 left join t1 q2 on q1.a = (select a from t1 limit 1) and q1.b=q2.b and q1.c=q2.c and q1.d=q2.d; MariaDB [gjd]> select * from t1 q1 join t1 q2 on q1.a = (select a from t1 limit 1) and q1.b=q2.b and q1.c=q2.c and q1.d=q2.d;
-----
----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roman [ 2020-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I believe this is b/c you try to join BASEID columns from ct(varchar (10)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Roman [ 2020-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Or varchar(10) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Gregory Dorman (Inactive) [ 2020-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
All right, please provide the complete DDL for all tables involved, I will do full research and investigation myself. Best if you e-mail it to me, but you can also post it here. Make sure it is for all tables involved in the query. |