[ 
https://issues.apache.org/jira/browse/IGNITE-25357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17950981#comment-17950981
 ] 

Evgeny Stanilovsky commented on IGNITE-25357:
---------------------------------------------

probably it will be fixed by [1] 

[1] https://github.com/apache/calcite/pull/4328


> Calcite engine. Wrong required columns calculation for double correlate
> -----------------------------------------------------------------------
>
>                 Key: IGNITE-25357
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25357
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Aleksey Plekhanov
>            Priority: Major
>              Labels: calcite, ise
>
> Reproducer:
> {code:java}
>     /** */
>     @Test
>     public void testCorrelateWrongRequiredColumn() throws Exception {
>         IgniteSchema schema = createSchema(
>             createTable("T1", IgniteDistributions.single(), "ID", 
> Integer.class, "NAME", String.class, "REF", Integer.class),
>             createTable("T2", IgniteDistributions.single(), "ID", 
> Integer.class, "REF", Integer.class),
>             createTable("T3", IgniteDistributions.single(), "ID", 
> Integer.class, "REF", Integer.class)
>         );
>         assertPlan("SELECT * FROM T1 WHERE EXISTS (" +
>                 "SELECT 1 FROM T2 WHERE T2.ID = T1.REF AND T2.REF = (SELECT 1 
> FROM T3 WHERE T3.ID = T1.REF))", schema,
>             nodeOrAnyChild(isTableScan("T1")));
>     }
> {code}
>  Throws an assertion error:
> {noformat}
>  java.lang.AssertionError: Required columns {2} not subset of left columns 
> {0, 1}
>       at org.apache.calcite.util.Litmus.lambda$static$0(Litmus.java:31) 
> ~[calcite-core-1.37.0.jar:1.37.0]
>       at org.apache.calcite.util.Litmus.check(Litmus.java:76) 
> ~[calcite-core-1.37.0.jar:1.37.0]
>       at org.apache.calcite.rel.core.Correlate.isValid(Correlate.java:145) 
> ~[calcite-core-1.37.0.jar:1.37.0]
>       at org.apache.calcite.rel.core.Correlate.<init>(Correlate.java:109) 
> ~[calcite-core-1.37.0.jar:1.37.0]
>       at 
> org.apache.calcite.rel.logical.LogicalCorrelate.<init>(LogicalCorrelate.java:73)
>  ~[calcite-core-1.37.0.jar:1.37.0]
>       at 
> org.apache.calcite.rel.logical.LogicalCorrelate.create(LogicalCorrelate.java:116)
>  ~[calcite-core-1.37.0.jar:1.37.0]
> {noformat}
>  



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

Reply via email to