0

I wrote some mapreduce code using the mapred import instead of mapreduce (I followed the example of WordCount for hadoop 1) I need to get some parameters that I saved in the job configuration. I read about configuration get when using mapreduce, but I did all my development using mapred and these two imports are conflicting. Is there a way to get the job configuration in the mapper using mapred?

Community
  • 1
  • 1
giulio
  • 659
  • 2
  • 8
  • 22

1 Answers1

1

From the Mapper Javadoc:

Mapper implementations can access the JobConf for the job via the JobConfigurable.configure(JobConf) and initialize themselves.

And as JobConf extends Configuration you can access all the properties from the.

To make this accessible to your map() calls you could create a JobConf variable in your class and set it in your configure() so that when your map() calls run you can access it from there.

Jeremy Beard
  • 2,727
  • 1
  • 20
  • 25
  • But since I don't have the context in the map arguments, is there a way to know which JobConf applies like in http://stackoverflow.com/questions/8244474/passing-arguments-to-hadoop-mappers ? – giulio Mar 07 '15 at 22:21