Class MergeLimitWithTopN

  • All Implemented Interfaces:
    Rule<LimitNode>

    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)