Class FilterFlattenCorrelatedConditionRule

@API(since="1.27", status=EXPERIMENTAL) @Enclosing public final class FilterFlattenCorrelatedConditionRule extends RelRule<FilterFlattenCorrelatedConditionRule.Config>
Planner rule that matches a Filter expression with correlated variables, and rewrites the condition in a simpler form that is more convenient for the decorrelation logic.

Uncorrelated calls below a comparison operator are turned into input references by extracting the computation in a Project expression. An additional projection may be added on top of the new filter to retain expression equivalence.

Sub-plan before

   LogicalFilter(condition=[=($cor0.DEPTNO, +($7, 30))])
     LogicalTableScan(table=[[CATALOG, SALES, EMP]])

Sub-plan after

   LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2],..., COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
     LogicalFilter(condition=[=($cor0.DEPTNO, $9)])
       LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2],..., SLACKER=[$8], $f9=[+($7, 30)])
         LogicalTableScan(table=[[CATALOG, SALES, EMP]])

The rule should be used in conjunction with other rules and transformations to have a positive impact on the plan. At the moment it is tightly connected with the decorrelation logic and may not be useful in a broader context. Projects may implement decorrelation differently so they may choose to use this rule or not.