Thank you! It works so well for me! Regards, Gefei
On Thu, Aug 14, 2014 at 4:25 PM, Tathagata Das <tathagata.das1...@gmail.com> wrote: > FlatMap the JavaRDD<BooleanPair[]> to JavaRDD<BooleanPair>. Then it should > work. > > TD > > > On Thu, Aug 14, 2014 at 1:23 AM, Gefei Li <gefeili.2...@gmail.com> 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 >> > >