Class CorrelateProjectExtractor

All Implemented Interfaces:
RelShuttle

@API(since="1.27", status=EXPERIMENTAL) public final class CorrelateProjectExtractor extends RelHomogeneousShuttle
A visitor for relational expressions that extracts a Project, with a "simple" computation over the correlated variables, from the right side of a correlation (Correlate) and places it on the left side.

Plan before

 LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])
   LogicalTableScan(table=[[scott, EMP]])
   LogicalFilter(condition=[=($0, +(10, $cor0.DEPTNO))])
     LogicalTableScan(table=[[scott, DEPT]])
 

Plan after

 LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3],... DNAME=[$10], LOC=[$11])
   LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{8}])
     LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], ... COMM=[$6], DEPTNO=[$7], $f8=[+(10, $7)])
       LogicalTableScan(table=[[scott, EMP]])
     LogicalFilter(condition=[=($0, $cor0.$f8)])
       LogicalTableScan(table=[[scott, DEPT]])
 

Essentially this transformation moves the computation over a correlated expression from the inner loop to the outer loop. It materializes the computation on the left side and flattens expressions on correlated variables on the right side.