user1585111
user1585111

Reputation: 1019

chaining mapreduce jobs in hadoop

I'm new to Hadoop. My task is to find an employee who has max salary. In my firstmap class I split the word and put the key and value like this -

outputcollector.collect("salary",salary);

In my reducer I found the maximum salary and had set the output like this

outputcollector.collect("max salary",maxsalary);

Now I want to use the output from this reducer in another mapper. I have constructed a chain like this

JobConf mapAConf = new JobConf(false);
        ChainMapper.addMapper(conf, mymap.class, LongWritable.class, Text.class, Text.class, IntWritable.class, true, mapAConf); 

JobConf reduceConf = new JobConf(false);
        ChainReducer.setReducer(conf, myreduce.class, Text.class, IntWritable.class, Text.class, IntWritable.class, true, reduceConf);

JobConf mapCConf = new JobConf(false);
       ChainReducer.addMapper(conf, LastMapper.class, Text.class, IntWritable.class, Text.class, IntWritable.class, true, mapCConf);

But the reducer is not getting executed. Any help on this?

Upvotes: 0

Views: 492

Answers (1)

Pankaj Khattar
Pankaj Khattar

Reputation: 111

You need to create & set the same JobConf for both mapper & reducer for a single Map/Reduce Job.

Upvotes: 0

Related Questions