AnsweredAssumed Answered

Spark Error: scala.collection.Seq in instance of org.apache.spark.rdd.MapPartitionsRDD

Question asked by danielsobrado on Mar 22, 2017
Latest reply on Apr 25, 2017 by ragavendran.ramadoss

I upgraded from Spark 1.6.1 to Spark version 2.0.1-mapr-1611, and I’m getting the following error that was was not happening in 1.6.1.

 

The code uses UDFs in Dataframes, that is the only difference I can spot from code that works in 2.0.1 and code that doesn't.

 

The issue happens executing remote with scala-ide and local with a packaged jar built with sbt.

 

Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 0.0 failed 4 times, most recent failure: Lost task 0.3 in stage 0.0 (TID 3, 10.111.180.51): java.lang.ClassCastException: cannot assign instance of scala.collection.immutable.List$SerializationProxy to field org.apache.spark.rdd.RDD.org$apache$spark$rdd$RDD$$dependencies_ of type scala.collection.Seq in instance of org.apache.spark.rdd.MapPartitionsRDD

            at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2133)

            at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1305)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2237)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)

            at scala.collection.immutable.List$SerializationProxy.readObject(List.scala:479)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2122)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)

            at scala.collection.immutable.List$SerializationProxy.readObject(List.scala:479)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2122)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)

            at scala.collection.immutable.List$SerializationProxy.readObject(List.scala:479)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2122)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)

            at scala.collection.immutable.List$SerializationProxy.readObject(List.scala:479)

            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            at java.lang.reflect.Method.invoke(Method.java:498)

            at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2122)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2231)

            at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2155)

            at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2013)

            at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)

            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)

            at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:75)

            at org.apache.spark.serializer.JavaSerializerInstance.deserialize(JavaSerializer.scala:114)

            at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:66)

            at org.apache.spark.scheduler.Task.run(Task.scala:86)

            at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:274)

            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

            at java.lang.Thread.run(Thread.java:745)

 

Driver stacktrace:

            at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1454)

            at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1442)

            at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1441)

            at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)

            at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)

            at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1441)

            at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:811)

            at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:811)

            at scala.Option.foreach(Option.scala:257)

            at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:811)

            at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:1667)

            at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1622)

            at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1611)

            at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:48)

            at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:632)

            at org.apache.spark.SparkContext.runJob(SparkContext.scala:1893)

            at org.apache.spark.SparkContext.runJob(SparkContext.scala:1906)

            at org.apache.spark.SparkContext.runJob(SparkContext.scala:1919)

            at org.apache.spark.sql.execution.SparkPlan.executeTake(SparkPlan.scala:347)

            at org.apache.spark.sql.execution.CollectLimitExec.executeCollect(limit.scala:39)

            at org.apache.spark.sql.Dataset$$anonfun$org$apache$spark$sql$Dataset$$execute$1$1.apply(Dataset.scala:2193)

            at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:57)

            at org.apache.spark.sql.Dataset.withNewExecutionId(Dataset.scala:2546)

            at org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$execute$1(Dataset.scala:2192)

            at org.apache.spark.sql.Dataset.org$apache$spark$sql$Dataset$$collect(Dataset.scala:2199)

            at org.apache.spark.sql.Dataset$$anonfun$head$1.apply(Dataset.scala:1935)

            at org.apache.spark.sql.Dataset$$anonfun$head$1.apply(Dataset.scala:1934)

            at org.apache.spark.sql.Dataset.withTypedCallback(Dataset.scala:2576)

            at org.apache.spark.sql.Dataset.head(Dataset.scala:1934)

            at org.apache.spark.sql.Dataset.head(Dataset.scala:1943)

            at org.apache.spark.sql.Dataset.first(Dataset.scala:1950)

Outcomes