在MultipleOutputs中 - 避免将我的密钥写入文件中

时间:2013-11-26 07:57:17

标签: java hadoop

您好我正在使用Hadoop mapreduce和im使用multipleoutput。以下是我的代码

mos = new MultipleOutputs(context);
mos.write(key, value, propertyName.trim());

但它会生成带有后缀-m-0000的多个文件。如何消除它?

而且我也不想在文件中打印我的密钥。那么如何才能避免将密钥写入文件中呢?

1 个答案:

答案 0 :(得分:0)

查看使用LazyOutputFormat - 如果没有通过context.write写入任何内容,它将不会创建默认输出文件:

job.setOutputFormat(LazyOutputFormat.class);

// This can be any file based output format
LazyOutputFormat.setOutputFormatClass(TextOutputFormat.class);