Using mapPartitions throughout