gaogaotiantian commented on code in PR #53757:
URL: https://github.com/apache/spark/pull/53757#discussion_r2683413372


##########
python/pyspark/core/rdd.py:
##########
@@ -1660,8 +1660,12 @@ def foreachPartition(self: "RDD[T]", f: 
Callable[[Iterable[T]], None]) -> None:
 
         def func(it: Iterable[T]) -> Iterable[Any]:
             r = f(it)
+            if r is None:
+                # This is the officially supported case
+                return iter([])
             try:
-                return iter(r)  # type: ignore[call-overload]
+                # We need to support generators because we used to

Review Comment:
   Yeah I updated the comment.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to