1. 程式人生 > >Hadoop原始碼詳解之FileOutputFormat 類

Hadoop原始碼詳解之FileOutputFormat 類

Hadoop 原始碼詳解之FileOutputFormat

1. 類釋義

A base class for OutputFormats that read from FileSystems.
一個類從FileSystems讀取 用於OutputFormats 【實在翻譯不好 _

2. 類原始碼

3. 方法詳解

3.1 setOutputPath()

Set the Path of the output directory for the map-reduce job.
map-reducejob設定輸出目錄。

  public
static void setOutputPath(Job job, Path outputDir) { try { outputDir = outputDir.getFileSystem(job.getConfiguration()).makeQualified( outputDir); } catch (IOException e) { // Throw the IOException as a RuntimeException to be compatible with MR1 throw new RuntimeException
(e); } job.getConfiguration().set(FileOutputFormat.OUTDIR, outputDir.toString()); }

可以看到的是,這裡的 setOutputPath()並沒有使用一個檔案列表組為輸出目錄。而檔案輸入路徑則可以是一個檔案列表。詳見 FileInputFormat類