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

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

     [ https://issues.apache.org/jira/browse/SPARK-12595?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen resolved SPARK-12595.
-------------------------------
    Resolution: Duplicate

> 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.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.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