学科分类
目录
Hadoop技术栈

OutputFormat组件

OutputFormat是一个用于描述MapReduce程序输出格式和规范的抽象类,该类定义了三个方法,具体代码如下:

public abstract class OutputFormat<K, V> {

 public abstract RecordWriter<K, V> 

  getRecordWriter(TaskAttemptContext context

​          ) throws IOException, InterruptedException;

 public abstract void checkOutputSpecs(JobContext context

​                    ) throws IOException,

​                         InterruptedException;

 public abstract 

 OutputCommitter getOutputCommitter(TaskAttemptContext context

​                   ) throws IOException, InterruptedException;

}

上述代码中,getRecordWriter()方法用于返回一个RecordWriter的实例,checkOutputSpecs()方法用于检测任务输出规范是否有效,getOutputCommiter()方法来负责输出被正确提交。

点击此处
隐藏目录