I've found a method saveAsObjectFile in RDD (or JavaRDD). I think we can
save this array to file and load back to object when read these file.
However, I've known the way to load back and cast RDD<generic object> to
specific object, need time to try.


On Thu, Aug 14, 2014 at 3:48 PM, Gefei Li <[email protected]> wrote:

> Thank you! It works so well for me!
>
> Regards,
> Gefei
>
>
> On Thu, Aug 14, 2014 at 4:25 PM, Tathagata Das <
> [email protected]> wrote:
>
>> FlatMap the JavaRDD<BooleanPair[]> to JavaRDD<BooleanPair>. Then it
>> should work.
>>
>> TD
>>
>>
>> On Thu, Aug 14, 2014 at 1:23 AM, Gefei Li <[email protected]> wrote:
>>
>>> Hello,
>>>     I wrote a class named BooleanPair:
>>>
>>> public static class BooleanPairet implements Serializable{
>>>         public Boolean elementBool1;
>>>         public Boolean elementBool2;
>>>         BooleanPair(Boolean bool1, Boolean bool2){elementBool1 = bool1;
>>> elementBool2 = bool2;}
>>>         public String toString(){return new String("(" + elementBool1 +
>>> "," + elementBool2 + ")");}
>>>     }
>>>
>>> And I create a RDD like this: javaRDD<BooleanPair[]>, a RDD of a
>>> BooleanPair array, when I use the method saveAsTextFile, and it gives me
>>> something like this"[Lmy.package.name.MyClassName$BooleanPair;@5b777a88",
>>> while it goes well with a javaRDD<BooleanPair>, just a value instead of an
>>> array.
>>>
>>> What should I do to save it in a format like "(true, false), (false,
>>> false)..."?
>>>
>>> My Spark version is 1.0.0, and I use the CDH-5.1.0 distribution.
>>>
>>> Thanks & Best Regards,
>>> Gefei
>>>
>>
>>
>


-- 
Thu.

Reply via email to