// which unions input from the two predecessor vertices
TezOperator unionTezOp = getTezOp();
tezPlan.add(unionTezOp);
unionTezOp.markUnion();
unionTezOp.setRequestedParallelism(op.getRequestedParallelism());
POShuffledValueInputTez unionInput = new POShuffledValueInputTez(OperatorKey.genOpKey(scope));
unionTezOp.plan.addAsLeaf(unionInput);
POValueOutputTez[] outputs = new POValueOutputTez[compiledInputs.length];
for (int i = 0; i < compiledInputs.length; i++) {
TezOperator prevTezOp = compiledInputs[i];
// Some predecessors of union need not be part of the union (For eg: replicated join).
// So mark predecessors that are input to the union operation.
unionTezOp.addUnionPredecessor(prevTezOp.getOperatorKey());
TezEdgeDescriptor edge = TezCompilerUtil.connect(tezPlan, prevTezOp, unionTezOp);
TezCompilerUtil.configureValueOnlyTupleOutput(edge, DataMovementType.SCATTER_GATHER);
outputs[i] = new POValueOutputTez(OperatorKey.genOpKey(scope));
outputs[i].addOutputKey(unionTezOp.getOperatorKey().toString());
unionInput.addInputKey(prevTezOp.getOperatorKey().toString());
prevTezOp.plan.addAsLeaf(outputs[i]);
prevTezOp.setClosed(true);
if (prevTezOp.isUseMRMapSettings()) {
unionTezOp.setUseMRMapSettings(true);
}