问题描述
如何按值对减速器输出进行降序排序?我正在开发一个必须返回收听次数最多的歌曲的应用程序.因此,歌曲必须按收听次数排序.我的应用程序以这种方式工作:
Input: songname@userid@boolean
MapOutput : songname userid
ReduceOutput : songname number_of_listening
有什么想法吗?
每文档,Reducer输出未重新排序.通过为 JobConf.setOutputValueGroupingComparator(Class),或者只是在一个单独的步骤中对reducer的最终输出进行排序. >
How can I sort in decreasing order the reducer output by value?I'm developing an application that must return top listened songs. Thus songs must be ordered by the number of listening.My application works in this way:
Input: songname@userid@boolean
MapOutput : songname userid
ReduceOutput : songname number_of_listening
Any idea how to do this?
Per the docs, Reducer output is not re-sorted. Either sort the input to the reducer (if that works for your application) by setting an appropriate value for JobConf.setOutputValueGroupingComparator(Class), or just sort the final output from the reducer in a separate step.
这篇关于MapReduce-如何排序按值减少输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!