Pavel Soubotko
Pavel Soubotko

Reputation: 11

Passing variable between map reduce Jobs

I'm having trouble understanding how do I pass variable (output) from Job1 to Job2.

lets say my Job1 is WordCount. the final reducer output in N=230.

My second job needs this information for its logic. but I dont want it as a Mapper Input. I want the Input to be the same as of Job1.

I prefer not using Counter as I read its not very reliable.

Thanks

Upvotes: 1

Views: 587

Answers (1)

Yann
Yann

Reputation: 361

You can pass N to the second job, adding N to the second job configuration object. To add any key/value to the configuration, you can use the 'set' method from the client submitting the job. Then, from the mapper, you can retrieve the value of N in the configuration, using the 'get' method. Look at 'configuration' documentation, you will find 'get', 'set', and many specialized method depending on the raw type of the value you want to add.

Upvotes: 1

Related Questions