I am bit confused here and do not understand how this can work.

The "addMapper" is the attached mapper that increments the aggregator for each element that it finds. As such, it really needs to be executed in the runtime. You give that mapper's input the null serializer. So no record can ever arrive at the mapper?