Hadoop 在您的实现中是否有人重写了Mapper运行(上下文)方法?
运行(上下文)org.apache.hadoop.mapreduce.Mapper的方法Hadoop 在您的实现中是否有人重写了Mapper运行(上下文)方法?,hadoop,mapper,Hadoop,Mapper,运行(上下文)org.apache.hadoop.mapreduce.Mapper的方法 a). Expert users can override this method for more complete control over the execution of the Mapper. 当前,run(Context)方法的默认行为是什么 如果我覆盖运行(上下文),根据文档,将获得什么样的特殊控件 在您的实现中是否有人重写了此方法 当前,run(Context)方法的默认行为是什么 默认实
a). Expert users can override this method for more complete control over the execution of the Mapper.
setup
进行一次性初始化映射
方法实现cleanup
进行一次性拆卸- 允许将多个
映射器
类实现链接在一起,以便在单个映射任务中执行。
的覆盖设置一个表示链的对象,并通过映射器链传递每个输入键/值对run
- 允许多线程执行另一个
类。映射器类必须是线程安全的。Mapper
的覆盖将启动多个线程,迭代输入键值对,并将它们传递给底层的run
Mapper
/**
* Expert users can override this method for more complete control over the
* execution of the Mapper.
* @param context
* @throws IOException
*/
public void run(Context context) throws IOException, InterruptedException {
setup(context);
try {
while (context.nextKeyValue()) {
map(context.getCurrentKey(), context.getCurrentValue(), context);
}
} finally {
cleanup(context);
}
}