如何根据hadoop中的值对字数进行排序? [英] how to sort word count by value in hadoop?

查看:181
本文介绍了如何根据hadoop中的值对字数进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习如何按照hadoop.i中的值对字数进行排序,我知道hadoop需要对键进行排序,而不是通过值。



我知道对我们必须有分区器,分组比较器和sortcomparator的值进行排序



但我在将这些概念一起应用于根据值对字数进行排序时有点困惑。



我们是否需要使用另一个地图缩减作业来实现同一个或另一个组合器来计算出现次数,然后在此处进行排序并将其发送到Reducer?

是否可以解释如何通过值对字数计数示例进行排序?

解决方案

您需要一秒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.

这篇关于如何根据hadoop中的值对字数进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆