MapReduce-如何排序按值减少输出 [英] MapReduce - How sort reduce output by value

查看:70
本文介绍了MapReduce-如何排序按值减少输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何按值对减速器输出进行降序排序? 我正在开发一个必须返回收听次数最多的歌曲的应用程序.因此,歌曲必须按收听次数排序. 我的应用程序以这种方式工作:

Input: songname@userid@boolean
MapOutput : songname userid
ReduceOutput : songname number_of_listening

有什么想法吗?

解决方案

解决方案

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-如何排序按值减少输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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