You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Gaurav Veda <ve...@gmail.com> on 2008/06/09 15:52:24 UTC
Writing a non-output file to HDFS
Hi,
I am new to Hadoop / HDFS, and am having trouble getting started. I am
trying to create a few files before launching a Map job (I want to read
these files inside each Map job). I want the files to be in text format. I
tried to modify the example program PiEstimator to achieve this. However, I
could not find the 'Text' equivalent of SequenceFile.createWriter. The
following doesn't work:
Path file = new Path(inDir, "currentVector.txt");
TextOutputFormat.LineRecordWriter writer = new
TextOutputFormat.LineRecordWriter(new FileOutputStream(file.toString()));
Any pointers?
Thanks,
Gaurav
--
Share what you know, learn what you don't !
Re: Writing a non-output file to HDFS
Posted by Gaurav Veda <ve...@gmail.com>.
Text writer = new Text();
FSDataOutputStream fsData = fileSys.create(file, true);
writer.writeString(fsData, "String");
The above works.
Thanks,
Gaurav
On Mon, Jun 9, 2008 at 9:52 AM, Gaurav Veda <ve...@gmail.com> wrote:
> Hi,
>
> I am new to Hadoop / HDFS, and am having trouble getting started. I am
> trying to create a few files before launching a Map job (I want to read
> these files inside each Map job). I want the files to be in text format. I
> tried to modify the example program PiEstimator to achieve this. However, I
> could not find the 'Text' equivalent of SequenceFile.createWriter. The
> following doesn't work:
>
> Path file = new Path(inDir, "currentVector.txt");
> TextOutputFormat.LineRecordWriter writer = new
> TextOutputFormat.LineRecordWriter(new FileOutputStream(file.toString()));
>
> Any pointers?
>
> Thanks,
> Gaurav
> --
> Share what you know, learn what you don't !
--
Share what you know, learn what you don't !