且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何根据hadoop中的值对字数进行排序?

更新时间:2022-12-06 13:12:18

您需要一秒mapreduce工作。除非你总结总数(第一个MR工作是这样),你怎么看待按价值排序(单词的计数)?逻辑上不可能。


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?

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.