Hadoop原始碼詳解之FileOutputFormat 類
阿新 • • 發佈:2018-12-27
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-reduce
job設定輸出目錄。
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類