You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maciej Szymkiewicz (JIRA)" <ji...@apache.org> on 2016/01/01 11:46:39 UTC

[jira] [Created] (SPARK-12595) fold should pass arguments to op in the correct order

Maciej Szymkiewicz created SPARK-12595:
------------------------------------------

             Summary: fold should pass arguments to op in the correct order
                 Key: SPARK-12595
                 URL: https://issues.apache.org/jira/browse/SPARK-12595
             Project: Spark
          Issue Type: Bug
          Components: PySpark
    Affects Versions: 1.5.0, 1.4.0, 1.3.0, 1.2.0, 1.1.0, 1.0.0, 1.6.0
            Reporter: Maciej Szymkiewicz
            Priority: Trivial


At this moment [fold method|https://github.com/apache/spark/blob/499ac3e69a102f9b10a1d7e14382fa191516f7b5/python/pyspark/rdd.py#L2316]  reverses an order of arguments and places accumulator on the RHS.

{code}
        def func(iterator):
            acc = zeroValue
            for obj in iterator:
                acc = op(obj, acc)
            yield acc
{code}

It is confusing (see linked SO question), clearly conflicts with documentation:

{quote}
The function op(t1, t2) is allowed to modify t1 and return it as its result value to avoid object allocation; however, it should not modify t2
{quote}

and may become a bug if implementation changes. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org