good_boy
good_boy

Reputation: 1

Hadoop MapReduce

How to perform Secondary sort on a Wordcount program so that the final output will be displayed in decreasing order ? (based on values)

Note: I am reading data from text file . if i have to use composite key, Partitioner, comparator, how to use it for this question ? In online for many example has four or five input, example temperature

https://vangjee.wordpress.com/2012/03/20/secondary-sorting-aka-sorting-values-in-hadoops-mapreduce-programming-paradigm/

Upvotes: 0

Views: 72

Answers (1)

Mark
Mark

Reputation: 414

Here I am assuming that the mapReduce program is in fact partitioning and sorting. To sort in reverse order you just add an 'r' after the sort value as shown in k1,1r.

This means that mapReduce will sort alphabetically in reverse order starting from z and going down to a.

-D mapreduce.partition.keycomparator.options="-k1,1r -k2,2 -k3,3"

Just make sure the partitioning and sorting is initially actually being done.

Upvotes: 0

Related Questions