简体   繁体   English

Hadoop:使用什么代替已弃用的接口Mapper和Reducer?

[英]Hadoop: What to use instead of deprecated interfaces Mapper and Reducer?

I'm using Hadoop version 0.22.0 downloaded here . 我使用的是此处下载的Hadoop版本0.22.0。 I started to create my custom mapper and reducer according to this tutorial and found out that interface Mapper<K1, V1, K2, V2> that is to be implemented by all mapper classes is deprecated. 我开始根据教程创建自定义的映射器和化简器,发现已弃用将由所有映射器类实现的接口Mapper<K1, V1, K2, V2> Interface Reducer<K2, V2, K3, V3> that is meant to be implemented by all reducers (at least according to the tutorial ) is also deprecated. Reducer<K2, V2, K3, V3>建议使用由所有reducer(至少根据本教程 )实现的Interface Reducer<K2, V2, K3, V3> So are classes like MapReduceBase and JobConf . MapReduceBaseJobConf类的类也是如此。 These are all core classes and interfaces that are needed by all custom mappers and reducers, aren't they? 这些都是所有自定义映射器和简化器所需的核心类和接口,不是吗? There is no note in javadoc what should be used as a replacement of those deprecated classes. javadoc中没有任何注释,应该使用什么代替那些已弃用的类。

So what interfaces and classes should I use instead of those deprecated ones? 那么,我应该使用哪些接口和类来代替那些不推荐使用的接口和类呢? Or should I use them anyway? 还是应该使用它们? Why are they deprecated? 为什么不推荐使用它们? Please just explain to me what's going on and what should I do because I'm not getting it. 请向我解释发生了什么事以及应该怎么做,因为我没有明白。

Classes from the org.apache.hadoop.mapred package are from the old MR API and from the org.apache.hadoop.mapreduce are from the new API. org.apache.hadoop.mapred包中的类来自旧的MR API,而org.apache.hadoop.mapreduce中的类来自新的API。 Note that all the classes have not been ported from the old API to the new API. 请注意,尚未将所有类从旧API移植到新API。 Here is a similar thread from SO. 这是来自SO的类似线程。

There is a class (not interface!) with the same name Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> in package org.apache.hadoop.mapreduce that should be used instead of the interface and base class. 在包org.apache.hadoop.mapreduce包中有一个具有相同名称Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>的类(而不是接口!),而不是接口和基类。 Same story with reducer: there is a class Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT> in package org.apache.hadoop.mapreduce . 与reducer的故事相同: org.apache.hadoop.mapreduce包中有一个类Reducer<KEYIN, VALUEIN, KEYOUT, VALUEOUT>

I still don't know what to do with JobConf and such but I'll update my answer when I found out. 我仍然不知道该如何JobConf类的东西,但是当我找到答案时,我会更新答案。


Edit: Class Configuration is to be used instead of JobConf . 编辑:将使用类Configuration代替JobConf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM