NullPointerException in Scala Spark, appears to be caused be collection type?

Spark doesn’t support nesting of RDDs (see https://stackoverflow.com/a/14130534/590203 for another occurrence of the same problem), so you can’t perform transformations or actions on RDDs inside of other RDD operations.

In the first case, you’re seeing a NullPointerException thrown by the worker when it tries to access a SparkContext object that’s only present on the driver and not the workers.

In the second case, my hunch is the job was run locally on the driver and worked purely by accident.

Leave a Comment