/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
int ret = ToolRunner.run(new Patent(), args);
doMerge(new Path("/output/patents"),new Path(
"/output/result/patents/result.txt"));
System.exit(ret);
}
private static void doMerge(Path srcPath ,Path destFile) throws IOException
{
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
FSDataOutputStream out = fs.create(destFile);
FileStatus[] srcs = fs.listStatus(srcPath,
new PathFilter() {
@Override
public boolean accept(Path path) {
return path.getName().startsWith("part-");
}
});
try {
for (FileStatus src : srcs) {
if (src.isFile()) {
FSDataInputStream in = fs.open(src.getPath());
try {
IOUtils.copyBytes(in, out, conf, false);
} finally {
in.close();
}
}
}
} finally {
out.close();
}
}