user1585111
user1585111

Reputation: 1019

how to sort word count by value in hadoop?

hi i wanted to learn how to sort the word count by value in hadoop.i know hadoop takes of sorting keys, but not by values.

i know to sort the values we must have a partitioner,groupingcomparator and a sortcomparator

but i am bit confused in applying these concepts together to sort the word count by value.

do we need another map reduce job to achieve the same or else a combiner to count the occurrences and then sort here and emit the same to reducer?

can any one explain how to sort word count example by values?

Upvotes: 13

Views: 27634

Answers (2)

Tariq
Tariq

Reputation: 34184

This is called as secondary sort. See this and this for details.

Upvotes: 8

Rags
Rags

Reputation: 1881

You need to have a second mapreduce job. Unless you conclude on the the totals counts (which the first MR job does) how can you think of sorting by value (the counts of the words)? Logically not possible.

Upvotes: 12

Related Questions