You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by ll <du...@gmail.com> on 2014/10/17 02:30:17 UTC

object in an rdd: serializable?

i got an exception complaining about serializable.  the sample code is
below...

class HelloWorld(val count: Int) {
  ...
  ...
}

object Test extends App {
  ...
  val data = sc.parallelize(List(new HelloWorld(1), new HelloWorld(2))) 
  ... 
}

what is the best way to serialize HelloWorld so that it can be contained in
an RDD?

thanks!




--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/object-in-an-rdd-serializable-tp16638.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: object in an rdd: serializable?

Posted by Duy Huynh <du...@gmail.com>.
interesting.  why does case class work for this?  thanks boromir!

On Thu, Oct 16, 2014 at 10:41 PM, Boromir Widas <vc...@gmail.com> wrote:

> make it a case class should work.
>
> On Thu, Oct 16, 2014 at 8:30 PM, ll <du...@gmail.com> wrote:
>
>> i got an exception complaining about serializable.  the sample code is
>> below...
>>
>> class HelloWorld(val count: Int) {
>>   ...
>>   ...
>> }
>>
>> object Test extends App {
>>   ...
>>   val data = sc.parallelize(List(new HelloWorld(1), new HelloWorld(2)))
>>   ...
>> }
>>
>> what is the best way to serialize HelloWorld so that it can be contained
>> in
>> an RDD?
>>
>> thanks!
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-user-list.1001560.n3.nabble.com/object-in-an-rdd-serializable-tp16638.html
>> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
>> For additional commands, e-mail: user-help@spark.apache.org
>>
>>
>

Re: object in an rdd: serializable?

Posted by Boromir Widas <vc...@gmail.com>.
make it a case class should work.

On Thu, Oct 16, 2014 at 8:30 PM, ll <du...@gmail.com> wrote:

> i got an exception complaining about serializable.  the sample code is
> below...
>
> class HelloWorld(val count: Int) {
>   ...
>   ...
> }
>
> object Test extends App {
>   ...
>   val data = sc.parallelize(List(new HelloWorld(1), new HelloWorld(2)))
>   ...
> }
>
> what is the best way to serialize HelloWorld so that it can be contained in
> an RDD?
>
> thanks!
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/object-in-an-rdd-serializable-tp16638.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>