How can you create a file inside a hadoop map-reduce job?
I searched the we开发者_如何学Cb, but all I found was a site that claimed that it could be done. It didn't say how.
FileSystem fs = FileSystem.get(conf);
Path path = new Path("/my/path/file")
OutputStream os = fs.create(path)
// write to os
os.close()
Look at the FileSystem's API: Click me
There is a method called "create()".
精彩评论