As shown in my code, I used RawLocalFileSystem() to return a
FileSystem reference. But when I create a HFile.Writer, in the path
parameter, I try to create a path in HDFS. There are two ways to
change the code into correct.

The first one is looks like:

FileSystem fs = new RawLocalFileSystem();
fs.setConf(new Configuration());
HFile.Writer hwriter = new HFile.Writer(fs, new Path("test"), 2,
(Compression.Algorithm)null, null);
the data is stored in the file:///.

The second one is looks like:

Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
HFile.Writer hwriter = new HFile.Writer(fs, new
Path("hdfs://localhost:8020/test"), 2, (Compression.Algorithm)null,
null);
the data is stored in the hdfs.

regards!

Yong
On Tue, Mar 6, 2012 at 5:10 PM, Stack <st...@duboce.net> wrote:
> On Tue, Mar 6, 2012 at 8:07 AM, yonghu <yongyong...@gmail.com> wrote:
>> Thanks for your reply. I have already solve the problem.
>>
>
> What did you do to fix it?
> Thanks,
> St.Ack

Reply via email to