Class PushPredicateThroughProjectIntoWindow

java.lang.Object
io.trino.sql.planner.iterative.rule.PushPredicateThroughProjectIntoWindow
All Implemented Interfaces:
Rule<FilterNode>

public class PushPredicateThroughProjectIntoWindow extends Object implements Rule<FilterNode>
This rule pushes filter predicate concerning a ranking symbol into WindowNode by converting it into TopNRankingNode. It skips an identity projection separating FilterNode from WindowNode in the plan tree. TODO This rule should be removed as soon as WindowNode becomes capable of absorbing pruning projections (i.e. capable of pruning outputs).

Transforms:

 - Filter (ranking invalid input: '<'= 5 invalid input: '&'invalid input: '&' a > 1)
     - Project (a, ranking)
         - Window ([row_number()|rank()] OVER (ORDER BY a))
             - source (a, b)
 
into:
 - Filter (a > 1)
     - Project (a, ranking)
         - TopNRanking (type = [ROW_NUMBER|RANK], maxRankingPerPartition = 5, order by a)
             - source (a, b)