java.lang.RuntimeException: Error while encoding: java.lang.ClassCastException: org.lala.Country cannot be cast to org.lala.Country staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) AS code#10 +- staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) +- invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)) +- input[0, ObjectType(class org.lala.Country)]

Stack Overflow | Adelave | 7 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    ClassCastException when using Spark Dataset API+case class+Spark Job Server

    Stack Overflow | 7 months ago | Adelave
    java.lang.RuntimeException: Error while encoding: java.lang.ClassCastException: org.lala.Country cannot be cast to org.lala.Country staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) AS code#10 +- staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) +- invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)) +- input[0, ObjectType(class org.lala.Country)]
  2. 0

    Spark dataset : Error while encoding: java.lang.ClassCastException

    GitHub | 6 months ago | wngasinur
    java.lang.RuntimeException: Error while encoding: java.lang.ClassCastException: org.lala.Country cannot be cast to org.lala.Country staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) AS code#10 +- staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) +- invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)) +- input[0, ObjectType(class org.lala.Country)]

    Root Cause Analysis

    1. java.lang.RuntimeException

      Error while encoding: java.lang.ClassCastException: org.lala.Country cannot be cast to org.lala.Country staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) AS code#10 +- staticinvoke(class org.apache.spark.unsafe.types.UTF8String,StringType,fromString,invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)),true) +- invoke(input[0, ObjectType(class org.lala.Country)],code,ObjectType(class java.lang.String)) +- input[0, ObjectType(class org.lala.Country)]

      at org.apache.spark.sql.catalyst.encoders.ExpressionEncoder.toRow()
    2. org.apache.spark
      ExpressionEncoder.toRow
      1. org.apache.spark.sql.catalyst.encoders.ExpressionEncoder.toRow(ExpressionEncoder.scala:220)
      1 frame
    3. Spark Project SQL
      SQLContext$$anonfun$8.apply
      1. org.apache.spark.sql.SQLContext$$anonfun$8.apply(SQLContext.scala:504)
      2. org.apache.spark.sql.SQLContext$$anonfun$8.apply(SQLContext.scala:504)
      2 frames
    4. Scala
      AbstractTraversable.map
      1. scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
      2. scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
      3. scala.collection.immutable.List.foreach(List.scala:318)
      4. scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
      5. scala.collection.AbstractTraversable.map(Traversable.scala:105)
      5 frames
    5. Spark Project SQL
      SQLImplicits.localSeqToDatasetHolder
      1. org.apache.spark.sql.SQLContext.createDataset(SQLContext.scala:504)
      2. org.apache.spark.sql.SQLImplicits.localSeqToDatasetHolder(SQLImplicits.scala:141)
      2 frames
    6. org.lala
      HelloJob$.runJob
      1. org.lala.HelloJob$.runJob(HelloJob.scala:18)
      2. org.lala.HelloJob$.runJob(HelloJob.scala:13)
      2 frames
    7. spark.jobserver
      JobManagerActor$$anonfun$spark$jobserver$JobManagerActor$$getJobFuture$4.apply
      1. spark.jobserver.JobManagerActor$$anonfun$spark$jobserver$JobManagerActor$$getJobFuture$4.apply(JobManagerActor.scala:301)
      1 frame