Map Reduce Programming


2 Answer(s)


Hi Sonu,

Yes, you can sort the data in Mapreduce with one mapper and multiple reducer.

One approach is to write seperate code for sorting and take the mapreduce output as input to it for sorting.

Or you can sort in descending order by write a separate comparator class which will do the trick. Include comparator inside the job as:

Job.setComparatorclass(Comparator.class);

This comparator will sort the values in descending order before sending to the reducer side. So on the reducer, you just emit the values.

>> So how should i get my final output as sorted from multiple reducers ?

Its depends on your code, you can apply sort on both keys and as well as values. Its all depend on your desired result you want.

Hope this helps.

Thanks


Thanks Abhijit