huaxingao 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_r336543679
##########
File path: python/pyspark/rdd.py
##########
@@ -2535,6 +2535,19 @@ def func(s, iterator):
return f(iterator)
return PipelinedRDD(self.rdd, func, preservesPartitioning,
isFromBarrier=True)
+ def mapPartitionsWithIndex(self, f, preservesPartitioning=False):
+ """
+ .. note:: Experimental
+
+ Returns a new RDD by applying a function to each partition of the
wrapped RDD,
+ where tasks are launched together in a barrier stage.
+ The interface is the same as :func:`RDD.mapPartitionsWithIndex`.
+ Please see the API doc there.
+
+ .. versionadded:: 2.4.0
+ """
+ return PipelinedRDD(self.rdd, f, preservesPartitioning,
isFromBarrier=True)
+
Review comment:
maybe add a python test for this newly added API?
----------------------------------------------------------------
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]