hadoop-hdfs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Yu <yubiaoe...@gmail.com>
Subject Re: How to define the path of HDFS?
Date Fri, 11 Sep 2009 12:47:06 GMT
My purpose is to serialize object to be a node of a btree.

 ObjectInputStream in = new ObjectInputStream(fs.open(new
Path("hdfs://leon1:9000/myDir/trajectory/" + pathToken + ".obj")));
 try {
         tempbtree =  (Btree) in.readObject();
       } catch (ClassNotFoundException e) {
       e.printStackTrace();
  }

Maybe the path is correct , but it throws an error as following :

cannot assign instance of [J to field rtree.Bnode.loc of type
[Lrtree.Trajectory; in instance of rtree.Bnode

How can I solve this problem ? Thank so much for your suggestion.

2009/9/11 Jingkei Ly <jly.list@googlemail.com>

> Forgive me if I've got the wrong end of the stick as I'm not very clear on
> what you are trying to achieve. Based on your original post, I presume you
> have a serialized object that you have already stored in HDFS that you would
> like to read and deserialize?
> If that is the case, then you should use:
>
> ObjectInputStream in = new ObjectInputStream(FileSystem.open(new
> Path("hdfs://localhost:9000/myDir/trajectory/test.obj")));
>
>
> 2009/9/11 Bill Yu <yubiaoever@gmail.com>
>
> Thanks for Jingkei's suggestion . But how can I serialize the input scream
>> to create a tree by FileSystem.open() ?
>> Anyone 's suggestion is appreciative!
>>
>> 2009/9/10 Jingkei Ly <jly.list@googlemail.com>
>>
>>  You should use FileSystem.open() to obtain an input stream to read from
>>> HDFS (
>>> http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#open%28org.apache.hadoop.fs.Path%29
>>> ).
>>>
>>> 2009/9/9 Bill Yu <yubiaoever@gmail.com>
>>>
>>> Hi everyone,
>>>>
>>>>      when I run the following code:
>>>>
>>>>      ObjectInputStream in = new ObjectInputStream(new
>>>> FileInputStream("hdfs://localhost:9000/myDir/trajectory/test.obj"));
>>>>
>>>>      it throws an error that the directory is not exist, how can I
>>>> define the its path ?
>>>>      Any suggestion is appreciate !
>>>>
>>>> Thanks,
>>>> Austin
>>>
>>>
>>>
>>
>

Mime
View raw message