如何更改 hadoop mr 作业中的 reducer 输出文件名?
How to change the reducer output file names in a hadoop mr job?
我有一个 reducer 脚本需要生成一堆 xml 文件。我想使用 reducer 键以编程方式设置文件名。我正在使用 MultipleOutputs
来完成以下操作。
MultipleOutputs mos = new MultipleOutputs(context);
mos.write(new Text(key), new Text(output), key + ".xml");
但输出文件名类似于 key.xml-r-00000
。如何从文件名中删除 -r-*
部分,以便它只是 key.xml
?
这里的-r-0000表示它是从reducer.We生成的,不能改,如果你想自定义文件名,在这些文件生成后写一个代码来更改文件名。
我有一个 reducer 脚本需要生成一堆 xml 文件。我想使用 reducer 键以编程方式设置文件名。我正在使用 MultipleOutputs
来完成以下操作。
MultipleOutputs mos = new MultipleOutputs(context);
mos.write(new Text(key), new Text(output), key + ".xml");
但输出文件名类似于 key.xml-r-00000
。如何从文件名中删除 -r-*
部分,以便它只是 key.xml
?
这里的-r-0000表示它是从reducer.We生成的,不能改,如果你想自定义文件名,在这些文件生成后写一个代码来更改文件名。