Combiner
A combiner performs optional local aggregation of map output before shuffle. It reduces communication when partial results can be merged without changing the required answer. It is not a global aggregation across every mapper.
Hadoop may invoke it zero or multiple times. Correctness must therefore survive those possibilities. The intermediate representation must remain suitable for further combining and the final reduction.
For an average, pass sums and counts. One mapper with [10] and another with [20, 20, 20, 20] have means 10 and 20. Their simple mean is 15, but merging (10, 1) with (80, 4) produces 90/5 = 18.
Integer sums work under the chosen numeric semantics; floating-point order and fixed-width overflow need care. Test uneven splits and empty inputs. Fewer shuffled pairs indicate less record traffic, not a guaranteed runtime reduction.
See What Hadoop Left Behind for worked examples.
Reference: Apache documentation.
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
