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

Zhen Chen updated CALCITE-7372:
-------------------------------
    Summary: TopDownGeneralDecorrelator will throw an error when the JOIN 
condition has correlation  (was: Throw the error message when JOIN condition 
has correlation)

> TopDownGeneralDecorrelator will throw an error when the JOIN condition has 
> correlation
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-7372
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7372
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.41.0
>            Reporter: Zhen Chen
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.42.0
>
>
> Using CoreQuidemTest2 to test the following SQL will result in an error.
> {code:java}
> WITH t0(t0a, t0b) AS (VALUES (1, 1), (2, 0)),
>      t1(t1a, t1b, t1c) AS (VALUES (1, 1, 3)),
>      t2(t2a, t2b, t2c) AS (VALUES (1, 1, 5), (2, 2, 7))
> SELECT * FROM t0 WHERE t0a <
> (SELECT sum(t1c) FROM
>   (SELECT t1c
>    FROM   t1 JOIN t2 ON (t1a < t0a AND t2b >= t1b))
> );
> +-----+-----+
> | T0A | T0B |
> +-----+-----+
> |   2 |   0 |
> +-----+-----+
> (1 row)
> !ok {code}
> Error message:
> > java.sql.SQLException: Error while executing SQL "WITH t0(t0a, t0b) AS 
> > (VALUES (1, 1), (2, 0)),
> >      t1(t1a, t1b, t1c) AS (VALUES (1, 1, 3)),
> >      t2(t2a, t2b, t2c) AS (VALUES (1, 1, 5), (2, 2, 7))
> > SELECT * FROM t0 WHERE t0a <
> > (SELECT sum(t1c) FROM
> >   (SELECT t1c
> >    FROM   t1 JOIN t2 ON (t1a < t0a AND t2b >= t1b))
> > )": The UnnestInfo for both sides of Join/Correlate that has correlation 
> > should not all be empty.
> >     at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
> >     at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
> >     at 
> > org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164)
> >     at 
> > org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228)
> >     at net.hydromatic.quidem.Quidem.checkResult(Quidem.java:317)
> >     at net.hydromatic.quidem.Quidem.access$2600(Quidem.java:54)
> >     at 
> > net.hydromatic.quidem.Quidem$ContextImpl.checkResult(Quidem.java:1778)
> >     at 
> > net.hydromatic.quidem.Quidem$CheckResultCommand.execute(Quidem.java:985)
> >     at 
> > net.hydromatic.quidem.Quidem$CompositeCommand.execute(Quidem.java:1522)
> >     at net.hydromatic.quidem.Quidem.execute(Quidem.java:204)
> >     at org.apache.calcite.test.QuidemTest.checkRun(QuidemTest.java:350)
> >     at org.apache.calcite.test.QuidemTest.test(QuidemTest.java:532)
> >     at org.apache.calcite.test.CoreQuidemTest2.main(CoreQuidemTest2.java:38)
>  



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

Reply via email to