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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Brijesh
  • 131
  • 1
  • 1
  • 5

2 Answers2

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.
SMA
  • 36,381
  • 8
  • 49
  • 73
  • One qq - is it also used to *transfer the data from the mapper to the reducer?* –  Feb 06 '17 at 00: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.

sras
  • 818
  • 7
  • 18