I have a simple RDD created from a seq as follows.
val testRDD = sc.parallelize(list.toSeq,size);
While iterating through the rows, it throws a null exception error in cluster mode. It works fine in client mode.
testRDD.foreach(row => {
logger.info("Row index " + row.index.toString() );
})
testRDD.count() and testRDD.partitions.size returns the appropriate results. When collect() action is performed foreach works fine, however I do not want collect in this scenario since the RDD needs to be distributed among nodes.