任何人都可以解释RecordReader如何实际工作?这些方法如何nextkeyvalue(),getCurrentkey()并getprogress()在程序开始执行后工作?
Chr*_*ite 14
(新API):默认的Mapper类有一个run方法,如下所示:
public void run(Context context) throws IOException, InterruptedException {
setup(context);
while (context.nextKeyValue()) {
map(context.getCurrentKey(), context.getCurrentValue(), context);
}
cleanup(context);
}
Run Code Online (Sandbox Code Playgroud)
的Context.nextKeyValue(),Context.getCurrentKey()和Context.getCurrentValue()方法的包装RecordReader方法.查看源文件src/mapred/org/apache/hadoop/mapreduce/MapContext.java.
所以这个循环执行并调用Mapper实现的map(K, V, Context)方法.
具体来说,您还想知道什么?
| 归档时间: |
|
| 查看次数: |
5712 次 |
| 最近记录: |