jonderry
jonderry

Reputation: 23633

How can you create a file inside a hadoop map-reduce job?

I searched the web, but all I found was a site that claimed that it could be done. It didn't say how.

Upvotes: 1

Views: 6594

Answers (2)

bajafresh4life
bajafresh4life

Reputation: 12853

FileSystem fs = FileSystem.get(conf);
Path path = new Path("/my/path/file")
OutputStream os = fs.create(path)
// write to os
os.close()

Upvotes: 3

Thomas Jungblut
Thomas Jungblut

Reputation: 20969

Look at the FileSystem's API: Click me
There is a method called "create()".

Upvotes: 2

Related Questions