You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Imran Rashid (JIRA)" <ji...@apache.org> on 2015/01/16 22:33:36 UTC

[jira] [Updated] (SPARK-733) Add documentation on use of accumulators in lazy transformation

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

Imran Rashid updated SPARK-733:
-------------------------------
    Fix Version/s: 1.2.1
                   1.3.0

> Add documentation on use of accumulators in lazy transformation
> ---------------------------------------------------------------
>
>                 Key: SPARK-733
>                 URL: https://issues.apache.org/jira/browse/SPARK-733
>             Project: Spark
>          Issue Type: Bug
>          Components: Documentation
>            Reporter: Josh Rosen
>             Fix For: 1.3.0, 1.2.1
>
>
> Accumulators updates are side-effects of RDD computations.  Unlike RDDs, accumulators do not carry lineage that would allow them to be computed when their values are accessed on the master.
> This can lead to confusion when accumulators are used in lazy transformations like `map`:
> {code}
>     val acc = sc.accumulator(0)
>     data.map(x => acc += x; f(x))
>     // Here, acc is 0 because no actions have cause the `map` to be computed.
> {code}
> As far as I can tell, our  documentation only includes examples of using accumulators in `foreach`, for which this problem does not occur.
> This pattern of using accumulators in map() occurs in Bagel and other Spark code found in the wild.
> It might be nice to document this behavior in the accumulators section of the Spark programming guide.



--
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