foreachPartition val data = spark.sparkContext.parallelize(1 to 100) // 使用 foreachPartition 批量处理分区 data.foreachPartition { partitionIterator =