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 <= 5 && 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)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.trino.sql.planner.iterative.Rule
Rule.Context, Rule.Result
-
-
Constructor Summary
Constructors Constructor Description PushPredicateThroughProjectIntoWindow(Metadata metadata, TypeOperators typeOperators)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rule.Resultapply(FilterNode filter, Captures captures, Rule.Context context)Pattern<FilterNode>getPattern()Returns a pattern to which plan nodes this rule applies.booleanisEnabled(Session session)
-
-
-
Constructor Detail
-
PushPredicateThroughProjectIntoWindow
public PushPredicateThroughProjectIntoWindow(Metadata metadata, TypeOperators typeOperators)
-
-
Method Detail
-
getPattern
public Pattern<FilterNode> getPattern()
Description copied from interface:RuleReturns a pattern to which plan nodes this rule applies.- Specified by:
getPatternin interfaceRule<FilterNode>
-
isEnabled
public boolean isEnabled(Session session)
- Specified by:
isEnabledin interfaceRule<FilterNode>
-
apply
public Rule.Result apply(FilterNode filter, Captures captures, Rule.Context context)
- Specified by:
applyin interfaceRule<FilterNode>
-
-