Class ImplementLimitWithTies
java.lang.Object
io.trino.sql.planner.iterative.rule.ImplementLimitWithTies
Transforms:
- Limit (row count = x, tiesResolvingScheme(a,b,c))
- source
Into:
- Project (prune rank symbol)
- Filter (rank invalid input: '<'= x)
- Window (function: rank, order by a,b,c)
- source
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.sql.planner.iterative.Rule
Rule.Context, Rule.Result -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(LimitNode parent, Captures captures, Rule.Context context) Returns a pattern to which plan nodes this rule applies.static PlanNoderewriteLimitWithTiesWithPartitioning(LimitNode limitNode, PlanNode source, Session session, Metadata metadata, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, List<Symbol> partitionBy) Rewrite LimitNode with ties to WindowNode and FilterNode, with partitioning defined by partitionBy.
-
Constructor Details
-
ImplementLimitWithTies
-
-
Method Details
-
getPattern
Description copied from interface:RuleReturns a pattern to which plan nodes this rule applies.- Specified by:
getPatternin interfaceRule<LimitNode>
-
apply
-
rewriteLimitWithTiesWithPartitioning
public static PlanNode rewriteLimitWithTiesWithPartitioning(LimitNode limitNode, PlanNode source, Session session, Metadata metadata, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, List<Symbol> partitionBy) Rewrite LimitNode with ties to WindowNode and FilterNode, with partitioning defined by partitionBy.This method does not prune outputs of the rewritten plan. After the rewrite, the output consists of source's output symbols and the newly created rankSymbol. Passing all input symbols is intentional, because this method is used for de-correlation in the scenario where the original LimitNode is in the correlated subquery, and the rewrite result is placed on top of de-correlated join. It is the responsibility of the caller to prune redundant outputs.
-