12

What exactly is this keyword Context in Hadoop MapReduce world in new API terms?

Its extensively used to write output pairs out of Maps and Reduce, however I am not sure if it can be used somewhere else and what's exactly happening whenever I use context. Is it a Iterator with different name?

What is relation between Class Mapper.Context, Class Reducer.Context and Job.Context?

Can someone please explain this starting with Layman's terms and then going in detail. Not able understand much from Hadoop API documentations.

Thanks for your time and help.

2 Answers 2

10

Context object: allows the Mapper/Reducer to interact with the rest of the Hadoop system. It includes configuration data for the job as well as interfaces which allow it to emit output.

Applications can use the Context:

  • to report progress
  • to set application-level status messages
  • update Counters
  • indicate they are alive
  • to get the values that are stored in job configuration across map/reduce phase.
1
  • One qq - is it also used to transfer the data from the mapper to the reducer?
    – user6490375
    Commented Feb 6, 2017 at 0:45
2

The new API makes extensive use of Context objects that allow the user code to communicate with MapRduce system.

It unifies the role of JobConf, OutputCollector, and Reporter from old API.

Not the answer you're looking for? Browse other questions tagged or ask your own question.