【发布时间】:2017-09-01 14:59:14
【问题描述】:
在作业中有两个输入文件,它们位于两个不同的目录中,在Hadoop job taking input files from multiple directories 中,我们可以从多个目录中读取文件。这些文件具有相同的名称,但它们位于不同名称的文件夹中。
C1/part-0000
C2/part-0000
是否可以在 map 阶段检测文件?
就像是:
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
if (First file) {
...
context.write(outputKey, outputValue);
}
} else {
//Second file
...
context.write(outputKey, outputValue);
}
}
【问题讨论】:
标签: file hadoop input mapreduce