@Override
public List<Pair<K3, V3>> run() throws IOException {
try {
preRunChecks(myMapper, myReducer);
initDistributedCache();
List<Pair<K2, V2>> mapOutputs = new ArrayList<Pair<K2, V2>>();
LOG.debug("Starting map phase with mapper: " + myMapper);
mapOutputs.addAll(MapDriver.newMapDriver(myMapper)
.withCounters(getCounters()).withConfiguration(getConfiguration())
.withAll(inputList).withMapInputPath(getMapInputPath()).run());
if (myCombiner != null) {
LOG.debug("Starting combine phase with combiner: " + myCombiner);
mapOutputs = new ReducePhaseRunner<K2, V2, K2, V2>(inputFormatClass,
getConfiguration(), counters,
getOutputSerializationConfiguration(), outputFormatClass)
.runReduce(sortAndGroup(mapOutputs), myCombiner);
}
LOG.debug("Starting reduce phase with reducer: " + myReducer);
return new ReducePhaseRunner<K2, V2, K3, V3>(inputFormatClass,
getConfiguration(), counters, getOutputSerializationConfiguration(),
outputFormatClass).runReduce(sortAndGroup(mapOutputs), myReducer);
} finally {
cleanupDistributedCache();
}
}