Hadoop中RecordReader的工作原理
有人能解释一下RecordReader是如何工作的吗?程序开始执行后,Hadoop中RecordReader的工作原理,hadoop,mapreduce,Hadoop,Mapreduce,有人能解释一下RecordReader是如何工作的吗?程序开始执行后,nextkeyvalue()、getCurrentkey()和getprogress()方法如何工作?(新API):默认映射器类有一个运行方法,如下所示: public void run(Context context) throws IOException, InterruptedException { setup(context); while (context.nextKeyValue()) {
nextkeyvalue()
、getCurrentkey()
和getprogress()
方法如何工作?(新API):默认映射器类有一个运行方法,如下所示:
public void run(Context context) throws IOException, InterruptedException {
setup(context);
while (context.nextKeyValue()) {
map(context.getCurrentKey(), context.getCurrentValue(), context);
}
cleanup(context);
}
Context.nextKeyValue()
、Context.getCurrentKey()
和Context.getCurrentValue()
方法是RecordReader
方法的包装器。请参阅源文件src/mapred/org/apache/hadoop/mapreduce/MapContext.java
因此,这个循环执行并调用映射器实现的map(K,V,Context)
方法
具体来说,您还想知道什么?org.apache.hadoop.mapred.MapTask -runNewMapper() Imp步骤:
@克丽丝……这很有帮助。。。。。你们能解释一下在recordreader中出现的拆分和记录吗?我很困惑…拆分是由InputFormat创建的,并且是从您传入的输入文件派生的,无论输入文件本身是否可拆分,以及您传递的其他选项(如max/min split sizeEach split),然后处理以生成传递到映射的记录method@Chris.. 非常感谢…现在我清楚了。。。。嘿,我需要另一个帮助。。你能帮我解决这个问题吗。。thnx..那么getProgress()呢?