Reputation: 1
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
Upvotes: 0
Views: 72
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