Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Repro:
@Test public void testSelectAnyCorrelated() { final String sql = "select empno > any(select deptno from dept where emp.job = dept.name) from emp\n" ; checkSubQuery(sql).withLateDecorrelation(true).check(); }
Error:
java.lang.AssertionError: correlation id $cor0 not found in correlation list [] at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) at org.apache.calcite.rex.RexChecker.visitCorrelVariable(RexChecker.java:174) at org.apache.calcite.rex.RexChecker.visitCorrelVariable(RexChecker.java:57) at org.apache.calcite.rex.RexCorrelVariable.accept(RexCorrelVariable.java:47) at org.apache.calcite.rex.RexVisitorImpl.visitFieldAccess(RexVisitorImpl.java:98) at org.apache.calcite.rex.RexChecker.visitFieldAccess(RexChecker.java:149) at org.apache.calcite.rex.RexChecker.visitFieldAccess(RexChecker.java:57) at org.apache.calcite.rex.RexFieldAccess.accept(RexFieldAccess.java:81) at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) at org.apache.calcite.test.SqlToRelConverterTest$RelValidityChecker.visit(SqlToRelConverterTest.java:3312) at org.apache.calcite.rel.SingleRel.childrenAccept(SingleRel.java:72) at org.apache.calcite.rel.RelVisitor.visit(RelVisitor.java:44)
The plan after SubQueryRemoveRule is:
LogicalProject(EXPR$0=[CAST(OR(AND(IS TRUE(>($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(>($0, $9))), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))):BOOLEAN NOT NULL]) LogicalJoin(condition=[true], joinType=[inner]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()], d=[COUNT($0)]) LogicalProject(DEPTNO=[$0]) LogicalFilter(condition=[=($cor0.JOB, $1)]) LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
It should be a Correlate, instead of a Join.
Attachments
Issue Links
- relates to
-
CALCITE-3222 Fix code style issues introduced by CALCITE-3031
- Closed
- links to