[
https://issues.apache.org/jira/browse/IMPALA-13483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941800#comment-17941800
]
weihua zhang commented on IMPALA-13483:
---------------------------------------
{code:java}
$ git clone https://github.com/apache/calcite.git
$ cd calcite/example/csv
$ ./sqlline
sqlline> !connect jdbc:calcite:model=src/test/resources/model.json admin admin
0: jdbc:calcite:model=src/test/resources/mode> with t1 (c1, c2) as (values
(1,null),(null,1),(1,2), (null,2),(1,3), (2,4), (2,5), (3,3), (3,4), (20,2),
(22,3), (24,4),(null,null)),
. . . . . . . . . . . . . . . . . . semicolon> t2 (c1, c2) as (values
(1,null),(null,1),(1,4), (1,2), (null,3), (2,4), (3,7), (3,9),(null,null),(5,1))
. . . . . . . . . . . . . . . . . . semicolon> select c1 from t1 where t1.c2 >
(select c1 from t2 where t1.c1 = t2.c1 and t2.c2 < 4) order by c1;
+----+
| C1 |
+----+
| 1 |
| 1 |
+----+
2 rows selected (0.13 seconds)
{code}
so calcite itself can right handle this query
> Calcite Planner: some scalar subquery throws exception
> ------------------------------------------------------
>
> Key: IMPALA-13483
> URL: https://issues.apache.org/jira/browse/IMPALA-13483
> Project: IMPALA
> Issue Type: Sub-task
> Reporter: weihua zhang
> Priority: Major
>
> {code:sql}
> create table correlated_scalar_t1(c1 bigint, c2 bigint);
> create table correlated_scalar_t2(c1 bigint, c2 bigint);
> insert into correlated_scalar_t1 values (1,null),(null,1),(1,2),
> (null,2),(1,3), (2,4), (2,5), (3,3), (3,4), (20,2), (22,3),
> (24,4),(null,null);
> insert into correlated_scalar_t2 values (1,null),(null,1),(1,4), (1,2),
> (null,3), (2,4), (3,7), (3,9),(null,null),(5,1);
> select c1 from correlated_scalar_t1 where correlated_scalar_t1.c2 > (select
> c1 from correlated_scalar_t2 where correlated_scalar_t1.c1 =
> correlated_scalar_t2.c1 and correlated_scalar_t2.c2 < 4) order by c1;{code}
> {code:java}
> LogicalSort(sort0=[$0], dir0=[ASC]), id = 717
> LogicalProject(C1=[$0]), id = 716
> LogicalJoin(condition=[AND(=($0, $2), >($1, $3))], joinType=[inner]), id
> = 715
> LogicalTableScan(table=[[default, correlated_scalar_t1]]), id = 547
> LogicalAggregate(group=[{0}], agg#0=[SINGLE_VALUE($1)]), id = 714
> LogicalProject(c11=[$0], C1=[$0]), id = 713
> LogicalFilter(condition=[AND(<($1, 4), IS NOT NULL($0))]), id = 712
> LogicalTableScan(table=[[default, correlated_scalar_t2]]), id =
> 549
> {code}
> Exception: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
> may be related to single_value
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]