gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 20:40:42 25 4
gpt4 key购买 nike

这是 reducer 的结果(执行器输出)。数据是书名(关键字),基于书名(值)借出多少本书的月份和频率,是否有任何方法可以获取唯一的具有最高值(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),但是您实际上并不关心键,然后解析出每行的数目,保持跟踪当前最大值及其相关行的长度。遍历所有值后,写入最大行。

为了缩短此过程的运行时间,请在作业配置中使用setCombinerClass来使用此新的reducer

关于hadoop - MapReduce,提取具有最高值的一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49786594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com