limitOper.markLimitAfterSort();
edge = TezCompilerUtil.connect(tezPlan, sortOpers[1], limitOper);
// LIMIT in this case should be ordered. So we output unordered with key as task index
// and on the input we use OrderedGroupedKVInput to do ordered merge to retain sorted order.
output.addOutputKey(limitOper.getOperatorKey().toString());
output.setTaskIndexWithRecordIndexAsKey(true);
edge = curTezOp.inEdges.get(sortOpers[1].getOperatorKey());
TezCompilerUtil.configureValueOnlyTupleOutput(edge, DataMovementType.SCATTER_GATHER);
// POValueOutputTez will write key (task index, record index) in
// sorted order. So using UnorderedKVOutput instead of OrderedPartitionedKVOutput.