SingleMergeExchange is created when a global order is required in the output. The following query produces the SingleMergeExchange.
On a 10 node cluster if the table is huge then DRILL can spawn many minor fragments which are all merged on a single node with one merge receiver. Doing so will create lot of memory pressure on the receiver node and also execution bottleneck. To address this issue, merge receiver should be multiphase merge receiver.
Ideally for large cluster one can introduce tree merges so that merging can be done parallel. But as a first step I think it is better to use the existing infrastructure for multiplexing operators to generate an OrderedMux so that all the minor fragments pertaining to one DRILLBIT should be merged and the merged data can be sent across to the receiver operator.
On a 10 node cluster if each node processes 14 minor fragments.
Current version of code merges 140 minor fragments
the proposed version has two level merges 1 - 14 merge in each drillbit which is parallel
and 10 minorfragments are merged at the receiver node.