// Sanity check
if (!(in instanceof ShuffledMergedInputLegacy)) {
throw new IOException("Illegal input to reduce: " + in.getClass());
}
ShuffledMergedInputLegacy shuffleInput = (ShuffledMergedInputLegacy)in;
KeyValuesReader kvReader = shuffleInput.getReader();
KeyValueWriter kvWriter = null;
if((out instanceof MROutputLegacy)) {
kvWriter = ((MROutputLegacy) out).getWriter();
} else if ((out instanceof OnFileSortedOutput)) {