Class MergeLimitWithTopN
- java.lang.Object
-
- io.prestosql.sql.planner.iterative.rule.MergeLimitWithTopN
-
public class MergeLimitWithTopN extends Object implements Rule<LimitNode>
This rule handles both LimitNode with ties and LimitNode without ties. In the case of LimitNode with ties, the LimitNode is removed if only its row count equals or exceeds TopNNode's row count:- Limit (5, with ties) - TopN (3)
is transformed into:- TopN (3)
In the case of LimitNode without ties, the LimitNode is removed, and the TopNNode's row count is updated to minimum row count of both nodes:- Limit (3) - TopN (5)
is transformed into:- TopN (3)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.prestosql.sql.planner.iterative.Rule
Rule.Context, Rule.Result
-
-
Constructor Summary
Constructors Constructor Description MergeLimitWithTopN()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rule.Result
apply(LimitNode parent, Captures captures, Rule.Context context)
Pattern<LimitNode>
getPattern()
Returns a pattern to which plan nodes this rule applies.
-
-
-
Method Detail
-
getPattern
public Pattern<LimitNode> getPattern()
Description copied from interface:Rule
Returns a pattern to which plan nodes this rule applies.- Specified by:
getPattern
in interfaceRule<LimitNode>
-
apply
public Rule.Result apply(LimitNode parent, Captures captures, Rule.Context context)
-
-