From d8c4b00a234514cc3a877e3daed5d1378a2637e8 Mon Sep 17 00:00:00 2001 From: Sean Owen <sowen@cloudera.com> Date: Tue, 19 Jan 2016 09:34:49 +0000 Subject: [PATCH] [SPARK-7683][PYSPARK] Confusing behavior of fold function of RDD in pyspark Fix order of arguments that Pyspark RDD.fold passes to its op - should be (acc, obj) like other implementations. Obviously, this is a potentially breaking change, so can only happen for 2.x CC davies Author: Sean Owen <sowen@cloudera.com> Closes #10771 from srowen/SPARK-7683. --- python/pyspark/rdd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyspark/rdd.py b/python/pyspark/rdd.py index a019c05862..c285946254 100644 --- a/python/pyspark/rdd.py +++ b/python/pyspark/rdd.py @@ -861,7 +861,7 @@ class RDD(object): def func(iterator): acc = zeroValue for obj in iterator: - acc = op(obj, acc) + acc = op(acc, obj) yield acc # collecting result of mapPartitions here ensures that the copy of # zeroValue provided to each partition is unique from the one provided -- GitLab