Test mapPartitions in Spark