Class GatherPartialTopN

java.lang.Object
io.trino.sql.planner.iterative.rule.GatherPartialTopN
All Implemented Interfaces:
Rule<ExchangeNode>

public class GatherPartialTopN extends Object implements Rule<ExchangeNode>
Adds local round-robin and gathering exchange on top of partial TopN to limit the task output size. Replaces plans like:
 exchange(remote)
   - topn(partial)
 
with
  exchange(remote)
      - topn(partial)
          - exchange(local, gather)
              - topn(partial)
                  - local_exchange(round_robin)
                      - topn(partial)