MAPREDUCE-1958. The MapReduce part corresponding to the HADOOP-6873. Contributed by Boris Shkolnik & Owen O'Malley.