Search

What are the methods in the Mapper class and order of their invocation?

run(Context context)
{
 setup(context);
 while (context.nextKeyValue())
 {
 map(context.getCurrentKey(), context.getCurrentValue(), context);
 }
 cleanup(context);
}

setup(Context context)
map(Writable key, Writable value, Context context)
cleanup(Context context)



The Mapper contains the run() method, which call its own setup() method only once, it also call a map() method for each input and finally calls it cleanup() method. We can override all above methods in our code.
Each of these methods can access the job’s configuration data by using Context.getConfiguration().