我能够正确地重命名我的减速器输出文件但r-00000仍然存在。 我在Reducer类中使用了MultipleOutputs。 这里是那个细节。不知道我错过了什么或者我还要做什么?如何删除mapreduce减速器输出r-00000延伸
public class MyReducer extends Reducer<NullWritable, Text, NullWritable, Text> {
private Logger logger = Logger.getLogger(MyReducer.class);
private MultipleOutputs<NullWritable, Text> multipleOutputs;
String strName = "";
public void setup(Context context) {
logger.info("Inside Reducer.");
multipleOutputs = new MultipleOutputs<NullWritable, Text>(context);
}
@Override
public void reduce(NullWritable Key, Iterable<Text> values, Context context)
throws IOException, InterruptedException {
for (Text value : values) {
final String valueStr = value.toString();
StringBuilder sb = new StringBuilder();
sb.append(strArrvalueStr[0] + "|!|");
multipleOutputs.write(NullWritable.get(), new Text(sb.toString()),strName);
}
}
public void cleanup(Context context) throws IOException,
InterruptedException {
multipleOutputs.close();
}
}
我觉得这个问题是重复的,请参阅以下链接: http://stackoverflow.com/questions/27488624/how-to-change-the-output-file-name-from-part-00000-in- reducer-inputfile-name –
我有overriden generateFileName()方法,但无法删除r-0000扩展名。 – SUDARSHAN