[
https://issues.apache.org/jira/browse/IMPALA-13483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941760#comment-17941760
]
weihua zhang commented on IMPALA-13483:
---------------------------------------
change
java/calcite-planner/src/main/java/org/apache/impala/calcite/rel/node/ImpalaAggRel.java
getCardinalityCheckNode
from
{code:java}
List<Expr> outputExprs =
ImmutableList.of(inputNodeWithExprs.outputExprs_.get(inputRef));
{code}
to
{code:java}
List<Expr> outputExprs = inputNodeWithExprs.outputExprs_;
{code}
now get
{code:java}
ERROR: Subquery must not return more than one row: CARDINALITY CHECK
{code}
but in postgresql/duckdb it will return
{code:java}
1
1
{code}
[~scarlin]
> 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]