MapReduce,提取具有最高值的一行

MapReduce, to extract the one row with highest value

这是减速器的结果(实际输出)。数据是根据书名(值),借多少本书的书名(键),月份和频率,有没有办法得到唯一具有最高价值的一行?例如,我想在很多行中选择频率最高的唯一行。如果你知道方法,请赐教。非常感谢。

"""E"" is for evidence [sound recording] / by Sue Grafton." 05  8
"""F"" is for fugitive [sound recording] / by Sue Grafton." 05  6
"""G"" is for Grafton : the world of Kinsey Millhone / Natalie Hevener Kaufman and Carol McGinnis Kay." 06  1
"""G"" is for gumshoe [text (large print)] / Sue Grafton."  09,10  1
"""Galapagos"" means ""tortoises"" / written and illustrated by Ruth Heller."   10,04,09  2
"""Git on board 09  1
"""God's banker"" / by Rupert Cornwell."    05,10,11  1
"""Gospodi-- spasi i usmiri Rossi︠i︡u"" : Nikolaĭ II    10,11  1
"""H"" is for homicide [sound recording] / by Sue Grafton." 12  4

运行 接受第一个操作的输出作为输入的辅助 mapreduce 作业。在 Mapper 中写入的值可以是 (NullWritable, line),因为你想将所有行收集到一个 reducer,但你并不真正关心键,否则解析出每行的数量,保持跟踪当前最大值及其关联的行。遍历所有值后,写入最大行。

要缩短此过程的 运行 时间,请在作业配置中使用 setCombinerClass 以使用此新减速器