MapReduce中Mapper类和Reducer类4函数解析
2012-05-12 19:56
351 查看
Mapper类4个函数的解析
protected void setup(Mapper.Context context) throws IOException,InterruptedException //Called once at the beginning of the task
protected void cleanup(Mapper.Context context)throws IOException,InterruptedException //Called once at the end of the task.
protected void map(KEYIN key, VALUEIN value Mapper.Context context)throws IOException,InterruptedException
//Called once for each key/value pair in the input split. Most applications should override this, but the default is the identity function.
public void run(Mapper.Context context)throws IOException,InterruptedException
//Expert users can override this method for more complete control over the execution of the Mapper.
执行顺序:setup ---> map/run ----> cleanup
同理在Reduce类中也存在4个函数
protected void setup(Mapper.Context context) throws IOException,InterruptedException //Called once at the beginning of the task
protected void cleanup(Mapper.Context context)throws IOException,InterruptedException //Called once at the end of the task.
protected void map(KEYIN key, VALUEIN value Mapper.Context context)throws IOException,InterruptedException
//This method is called once for each key. Most applications will define their reduce class by overriding this method. The default implementation is an identity function. public void run(Mapper.Context context)throws IOException,InterruptedException
//Advanced application writers can use the [code]run(org.apache.hadoop.mapreduce.Reducer.Context)method to control how the reduce task works[/code]
执行顺序:setup ---> map/run ----> cleanup
相关文章推荐
- MapReduce之Mapper类,Reducer类中的函数(转载)
- MapReduce框架Mapper和Reducer类源码分析
- Hadoop(十七)之MapReduce作业配置与Mapper和Reducer类
- Hadoop(十七)之MapReduce作业配置与Mapper和Reducer类【转载】
- MapReduce小解析
- C++中类的静态数据成员函数解析
- Linux 多线程函数解析
- VC中的DoDataExchange函数解析
- 有趣的函数解析机制1
- c++ primer 类中函数调用过程解析(虚函数与作用域) P550疑问解析
- 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainCRTStartup 中被引用
- JavaScript函数执行时函数实参赋值和函数内部预解析的顺序
- mybatis如何加载mapper并解析的
- MyBatis-3.4.2-源码分析14:XML解析之sqlElement(context.evalNodes("/mapper/sql"))
- 无法解析的外部符号 _mysql_init@4,该符号在函数 _main 中被引用
- enumerate函数解析
- Linux C语言应用 - main函数解析,时间函数,C语言代码的分配机制(malloc,calloc,realloc,free)
- 函数调用堆栈的汇编解析
- VC++文件操作函数解析
- oracle函数+过程,解析字符串信息作为字段,并动态更新数据表