gpt4 book ai didi

hadoop - 应该从 Hadoop 中的哪个类继承(或扩展)Combiner?

转载 作者:行者123 更新时间:2023-12-02 21:55:53 26 4
gpt4 key购买 nike

在 Hadoop 中,mapper 和 reducer 类应该扩展 Mapper 或 Reducer 接口(interface)。但是,我找不到组合器类应该扩展的接口(interface)。 Hadoop 中组合器类的签名是什么?

最佳答案

一个组合器扩展了 Reducer接口(interface),并且其签名应该发出与其使用相同的键/值类型,例如字数组合器具有以下签名(对于新的 o.a.h.mapreduce 和旧的 o.a.h.mapred 包):

public class MyCombinerNewApi 
extends Reducer<Text, IntWritable, Text, IntWritable> {

}

public class MyCombinerOldApi
implements Reducer<Text, IntWritable, Text, IntWritable> {

}

有时,Combiner 类与 Reducer 类相同(如 Word Count 示例中所示)是很常见的。

一些很好的链接更详细地解释了组合器:
  • Phillipe Adjimun 在 "To use or not to use a combiner" 上的博客
  • Pro Hadoop Book - Combiners
  • 关于hadoop - 应该从 Hadoop 中的哪个类继承(或扩展)Combiner?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14167462/

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