ConeyLiu commented on a change in pull request #26148: 
[SPARK-29499][CORE][PYSPARK] Add mapPartitionsWithIndex for RDDBarrier
URL: https://github.com/apache/spark/pull/26148#discussion_r337337760
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/rdd/RDDBarrierSuite.scala
 ##########
 @@ -29,6 +29,15 @@ class RDDBarrierSuite extends SparkFunSuite with 
SharedSparkContext {
     assert(rdd2.isBarrier())
   }
 
+  test("RDDBarrier mapPartitionsWithIndex") {
+    val rdd = sc.parallelize(1 to 12, 4)
+    assert(rdd.isBarrier() === false)
+
+    val rdd2 = rdd.barrier().mapPartitionsWithIndex((index, iter) => 
Iterator(index, iter.sum))
+    assert(rdd2.isBarrier())
+    assert(rdd2.collect().toList === List((0, 6), (1, 15), (2, 24), (3, 33)))
 
 Review comment:
   thanks for reviewing, updated it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to