我能夠正確地重命名我的減速器輸出文件但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