/**
* Called once at the start of the task.
只在任务开始的时候 运行一次
*/
protected void setup(Context context
) throws IOException, InterruptedException {
// NOTHING
}
/**
* 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.
每个key都运行一次。
*/
@SuppressWarnings("unchecked")
protected void reduce(KEYIN key, Iterable<VALUEIN> values, Context context
) throws IOException, InterruptedException {
for(VALUEIN value: values) {
context.write((KEYOUT) key, (VALUEOUT) value);
}
}
/**
* Called once at the end of the task.
只在任务结束的时候运行一次
*/
protected void cleanup(Context context
) throws IOException, InterruptedException {
// NOTHING
}
Mapper reducer 的生命周期
最新推荐文章于 2024-06-07 01:24:11 发布