Replace newRDD[T] with mapPartitions().