Skip to content

Commit 02d0575

Browse files
committed
add wrapper for foreachRDD()
1 parent bebeb4a commit 02d0575

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

python/pyspark/streaming/dstream.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ def foreachRDD(self, func):
150150
"""
151151
Apply a function to each RDD in this DStream.
152152
"""
153+
if func.func_code.co_argcount == 1:
154+
old_func = func
155+
func = lambda t, rdd: old_func(rdd)
153156
jfunc = TransformFunction(self._sc, func, self._jrdd_deserializer)
154157
api = self._ssc._jvm.PythonDStream
155158
api.callForeachRDD(self._jdstream, jfunc)

0 commit comments

Comments
 (0)