疑问 : hadoop API 中 旧版 OutputFormat 是接口, 而新版 API 的 OutputFormat 是抽象类

仁者见仁,智者见智

请各位大侠不吝赐教

1.旧版 API 的 OutputFormat 

public interface OutputFormat<K, V> {
   RecordWriter<K, V> getRecordWriter(FileSystem arg0, JobConf arg1, String arg2, Progressable arg3) throws IOException;

   void checkOutputSpecs(FileSystem arg0, JobConf arg1) throws IOException;
}

2.新版API 的 OutputFormat 

public abstract class OutputFormat<K, V> {
   public abstract RecordWriter<K, V> getRecordWriter(TaskAttemptContext arg0) throws IOException, InterruptedException;

   public abstract void checkOutputSpecs(JobContext arg0) throws IOException, InterruptedException;

   public abstract OutputCommitter getOutputCommitter(TaskAttemptContext arg0) throws IOException, InterruptedException;
}

接口是对行为的封装,抽象是对事物的封装

个人认为,旧版本的API 可能不是十分恰当

consult :

https://blog.csdn.net/u010159842/article/details/71083650

https://www.cnblogs.com/wuyudong/p/4348704.html

猜你喜欢

转载自blog.csdn.net/tianyeshiye/article/details/86672478