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类