suibianwanwank commented on code in PR #4397:
URL: https://github.com/apache/calcite/pull/4397#discussion_r2117829127
##########
core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml:
##########
@@ -9557,6 +9557,58 @@ LogicalProject(EXPR$0=[CAST(/($2, $3)):INTEGER NOT NULL])
LogicalAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[MIN($2)],
agg#2=[AVG($2)])
LogicalProject(DEPTNO=[$7], SAL=[$5], EMPNO=[$0])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase name="testNestedCorrelate">
+ <Resource name="sql">
+ <![CDATA[SELECT * FROM emp
+WHERE NOT EXISTS (SELECT true
+ FROM dept
+ WHERE EXISTS (
+ SELECT true FROM salgrade
+ WHERE salgrade.losal < dept.deptno
+ )
+ AND emp.deptno = dept.deptno
+)
+]]>
+ </Resource>
+ <Resource name="planBefore">
+ <![CDATA[
+LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4],
SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
+ LogicalFilter(condition=[NOT(IS NOT NULL($9))])
+ LogicalCorrelate(correlation=[$cor1], joinType=[left],
requiredColumns=[{7}])
+ LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+ LogicalAggregate(group=[{}], agg#0=[MIN($0)])
+ LogicalProject($f0=[true])
+ LogicalFilter(condition=[AND(IS NOT NULL($2), =($cor1.DEPTNO, $0))])
+ LogicalCorrelate(correlation=[$cor0], joinType=[left],
requiredColumns=[{0}])
+ LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
+ LogicalAggregate(group=[{}], agg#0=[MIN($0)])
+ LogicalProject($f0=[true])
+ LogicalFilter(condition=[<($1, $cor0.DEPTNO)])
+ LogicalTableScan(table=[[CATALOG, SALES, SALGRADE]])
+]]>
+ </Resource>
+ <Resource name="planAfter">
+ <![CDATA[
+LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4],
SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
Review Comment:
Regarding the current decorrelation, a good approach to add tests is to
introduce Values in the outer RelNode to determine if partial decorrelation is
feasible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]