Class ImplementLimitWithTies

  • All Implemented Interfaces:
    Rule<LimitNode>

    public class ImplementLimitWithTies
    extends Object
    implements Rule<LimitNode>
    Transforms:
     - Limit (row count = x, tiesResolvingScheme(a,b,c))
        - source
     
    Into:
     - Project (prune rank symbol)
        - Filter (rank <= x)
           - Window (function: rank, order by a,b,c)
              - source
     
    • Constructor Detail

      • ImplementLimitWithTies

        public ImplementLimitWithTies​(Metadata metadata)
    • Method Detail

      • 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.