aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/streaming/dstream.py
diff options
context:
space:
mode:
authorDavid Tolpin <david.tolpin@gmail.com>2015-11-19 13:57:23 -0800
committerTathagata Das <tathagata.das1565@gmail.com>2015-11-19 13:57:23 -0800
commit599a8c6e2bf7da70b20ef3046f5ce099dfd637f8 (patch)
tree620b913655b307547d9aee37c1f7ec6d68a3d0ef /python/pyspark/streaming/dstream.py
parent4700074530d9a398843e13f0ef514be97a237cea (diff)
downloadspark-599a8c6e2bf7da70b20ef3046f5ce099dfd637f8.tar.gz
spark-599a8c6e2bf7da70b20ef3046f5ce099dfd637f8.tar.bz2
spark-599a8c6e2bf7da70b20ef3046f5ce099dfd637f8.zip
[SPARK-11812][PYSPARK] invFunc=None works properly with python's reduceByKeyAndWindow
invFunc is optional and can be None. Instead of invFunc (the parameter) invReduceFunc (a local function) was checked for trueness (that is, not None, in this context). A local function is never None, thus the case of invFunc=None (a common one when inverse reduction is not defined) was treated incorrectly, resulting in loss of data. In addition, the docstring used wrong parameter names, also fixed. Author: David Tolpin <david.tolpin@gmail.com> Closes #9775 from dtolpin/master.
Diffstat (limited to 'python/pyspark/streaming/dstream.py')
-rw-r--r--python/pyspark/streaming/dstream.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/pyspark/streaming/dstream.py b/python/pyspark/streaming/dstream.py
index 698336cfce..acec850f02 100644
--- a/python/pyspark/streaming/dstream.py
+++ b/python/pyspark/streaming/dstream.py
@@ -524,8 +524,8 @@ class DStream(object):
`invFunc` can be None, then it will reduce all the RDDs in window, could be slower
than having `invFunc`.
- @param reduceFunc: associative reduce function
- @param invReduceFunc: inverse function of `reduceFunc`
+ @param func: associative reduce function
+ @param invFunc: inverse function of `reduceFunc`
@param windowDuration: width of the window; must be a multiple of this DStream's
batching interval
@param slideDuration: sliding interval of the window (i.e., the interval after which
@@ -556,7 +556,7 @@ class DStream(object):
if kv[1] is not None else kv[0])
jreduceFunc = TransformFunction(self._sc, reduceFunc, reduced._jrdd_deserializer)
- if invReduceFunc:
+ if invFunc:
jinvReduceFunc = TransformFunction(self._sc, invReduceFunc, reduced._jrdd_deserializer)
else:
jinvReduceFunc = None