Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
1.15.0
-
None
-
None
Description
test case in RelOptRulesTest.java:
@Test public void testDecorrelateWithProject() throws Exception { final String sql = "select sal,\n" + "exists (select * from emp_b where emp.deptno = emp_b.deptno)\n" + "from sales.emp"; checkSubQuery(sql).withLateDecorrelation(true).check(); }
after SqlToRelConverter, the plan is
LogicalProject(SAL=[$5], EXPR$1=[EXISTS({ LogicalFilter(condition=[=($cor0.DEPTNO, $7)]) LogicalTableScan(table=[[CATALOG, SALES, EMP_B]]) })]) LogicalTableScan(table=[[CATALOG, SALES, EMP]])
NOTES: LogicalProject does not have any variablesSet attributes.
the correct plan should be:
LogicalProject(SAL=[$5], EXPR$1=[EXISTS({ LogicalFilter(condition=[=($cor0.DEPTNO, $7)]) LogicalTableScan(table=[[CATALOG, SALES, EMP_B]]) })], variablesSet=[[$cor0]]) LogicalTableScan(table=[[CATALOG, SALES, EMP]])