[ 
https://issues.apache.org/jira/browse/CALCITE-7403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zhen Chen updated CALCITE-7403:
-------------------------------
    Description: 
Using CoreQuidemTest2 to test the following SQL will result in an error.

 
{code:java}
# [CALCITE-6786] ANY/SOME operator yields multiple rows in correlated queries
WITH tb as (select array(SELECT * FROM (VALUES (TRUE), (NULL)) as x(a)) as a)
SELECT TRUE IN (SELECT b FROM UNNEST(a) AS x1(b)) AS test FROM tb;
+------+
| TEST |
+------+
| true |
+------+
(1 row)

!ok {code}
Error message:
{code:java}
> java.sql.SQLException: Error while executing SQL "WITH tb as (select 
> array(SELECT * FROM (VALUES (TRUE), (NULL)) as x(a)) as a)
> SELECT TRUE IN (SELECT b FROM UNNEST(a) AS x1(b)) AS test FROM tb": There are 
> not enough rules to produce a node with desired properties: 
> convention=ENUMERABLE, sort=[].
> Missing conversion is LogicalConditionalCorrelate[convention: NONE -> 
> ENUMERABLE]
> There is 1 empty subset: rel#1188424:RelSubset#7.ENUMERABLE.[], the relevant 
> part of the original plan is as follows
> 1188394:LogicalConditionalCorrelate(correlation=[$cor0], 
> joinType=[left_mark], requiredColumns=[{0}], condition=[$1])
>   1188384:Collect(subset=[rel#1188385:RelSubset#2.NONE.[]], field=[x])
>     1188244:LogicalValues(subset=[rel#1188383:RelSubset#1.NONE.[0]], 
> tuples=[[{ true }, { null }]])
>   1188392:Uncollect(subset=[rel#1188393:RelSubset#6.NONE.[]])
>     1188390:LogicalProject(subset=[rel#1188391:RelSubset#5.NONE.[]], 
> A=[$cor0.A])
>       1188237:LogicalValues(subset=[rel#1188382:RelSubset#0.NONE.[0]], 
> tuples=[[{ 0 }]]) {code}

  was:
Using CoreQuidemTest2 to test the following SQL will result in an error.

 
{code:java}
# [CALCITE-6786] ANY/SOME operator yields multiple rows in correlated 
queriesWITH tb as (select array(SELECT * FROM (VALUES (TRUE), (NULL)) as x(a)) 
as a)
SELECT TRUE IN (SELECT b FROM UNNEST(a) AS x1(b)) AS test FROM tb;
+------+
| TEST |
+------+
| true |
+------+
(1 row)

!ok {code}
Error message:
{code:java}
> java.sql.SQLException: Error while executing SQL "WITH tb as (select 
> array(SELECT * FROM (VALUES (TRUE), (NULL)) as x(a)) as a)
> SELECT TRUE IN (SELECT b FROM UNNEST(a) AS x1(b)) AS test FROM tb": There are 
> not enough rules to produce a node with desired properties: 
> convention=ENUMERABLE, sort=[].
> Missing conversion is LogicalConditionalCorrelate[convention: NONE -> 
> ENUMERABLE]
> There is 1 empty subset: rel#1188424:RelSubset#7.ENUMERABLE.[], the relevant 
> part of the original plan is as follows
> 1188394:LogicalConditionalCorrelate(correlation=[$cor0], 
> joinType=[left_mark], requiredColumns=[{0}], condition=[$1])
>   1188384:Collect(subset=[rel#1188385:RelSubset#2.NONE.[]], field=[x])
>     1188244:LogicalValues(subset=[rel#1188383:RelSubset#1.NONE.[0]], 
> tuples=[[{ true }, { null }]])
>   1188392:Uncollect(subset=[rel#1188393:RelSubset#6.NONE.[]])
>     1188390:LogicalProject(subset=[rel#1188391:RelSubset#5.NONE.[]], 
> A=[$cor0.A])
>       1188237:LogicalValues(subset=[rel#1188382:RelSubset#0.NONE.[0]], 
> tuples=[[{ 0 }]]) {code}


> Missing ENUMERABLE Convention for LogicalConditionalCorrelate
> -------------------------------------------------------------
>
>                 Key: CALCITE-7403
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7403
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.41.0
>            Reporter: Zhen Chen
>            Priority: Major
>
> Using CoreQuidemTest2 to test the following SQL will result in an error.
>  
> {code:java}
> # [CALCITE-6786] ANY/SOME operator yields multiple rows in correlated queries
> WITH tb as (select array(SELECT * FROM (VALUES (TRUE), (NULL)) as x(a)) as a)
> SELECT TRUE IN (SELECT b FROM UNNEST(a) AS x1(b)) AS test FROM tb;
> +------+
> | TEST |
> +------+
> | true |
> +------+
> (1 row)
> !ok {code}
> Error message:
> {code:java}
> > java.sql.SQLException: Error while executing SQL "WITH tb as (select 
> > array(SELECT * FROM (VALUES (TRUE), (NULL)) as x(a)) as a)
> > SELECT TRUE IN (SELECT b FROM UNNEST(a) AS x1(b)) AS test FROM tb": There 
> > are not enough rules to produce a node with desired properties: 
> > convention=ENUMERABLE, sort=[].
> > Missing conversion is LogicalConditionalCorrelate[convention: NONE -> 
> > ENUMERABLE]
> > There is 1 empty subset: rel#1188424:RelSubset#7.ENUMERABLE.[], the 
> > relevant part of the original plan is as follows
> > 1188394:LogicalConditionalCorrelate(correlation=[$cor0], 
> > joinType=[left_mark], requiredColumns=[{0}], condition=[$1])
> >   1188384:Collect(subset=[rel#1188385:RelSubset#2.NONE.[]], field=[x])
> >     1188244:LogicalValues(subset=[rel#1188383:RelSubset#1.NONE.[0]], 
> > tuples=[[{ true }, { null }]])
> >   1188392:Uncollect(subset=[rel#1188393:RelSubset#6.NONE.[]])
> >     1188390:LogicalProject(subset=[rel#1188391:RelSubset#5.NONE.[]], 
> > A=[$cor0.A])
> >       1188237:LogicalValues(subset=[rel#1188382:RelSubset#0.NONE.[0]], 
> > tuples=[[{ 0 }]]) {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to