title: Scala/Spark serializable error - join don't work
body: <p>I am trying to use join method between 2 RDD and save it to cassandra but my code don't work . at the begining , i get a huge Main method and everything working well , but when i use function and class this don't work . i am new to scala and spark</p>
  
  <p>code is :</p>
  
  <pre><code>  class Migration extends Serializable { 
  
    case class userId(offerFamily: String, bp: String, pdl: String) extends Serializable
    case class siteExternalId(site_external_id: Option[String]) extends Serializable
    case class profileData(begin_ts: Option[Long], Source: Option[String]) extends Serializable
  
    def SparkMigrationProfile(sc: SparkContext) = {
  
      val test  = sc.cassandraTable[siteExternalId](KEYSPACE,TABLE)
       .keyBy[userId]
       .filter(x =&gt; x._2.site_external_id != None)
  
      val profileRDD = sc.cassandraTable[profileData](KEYSPACE,TABLE)
      .keyBy[userId]
  
      //dont work
     test.join(profileRDD)
      .foreach(println)
  
      // don't work
       test.join(profileRDD)
       .saveToCassandra(keyspace, table)
  
     }
  </code></pre>
  
  <p>At the beginig i get the famous : Exception in thread "main" org.apache.spark.SparkException: Task not serializable at . . .
  so i extends my main class and also the case class but stil don't work .</p>