Github user CodingCat commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2490#discussion_r17949828
  
    --- Diff: docs/programming-guide.md ---
    @@ -1183,6 +1188,10 @@ running on the cluster can then add to it using the 
`add` method or the `+=` ope
     However, they cannot read its value.
     Only the driver program can read the accumulator's value, using its 
`value` method.
     
    +The same task may run multiple times, either when its output data becomes 
lost or when multiple
    +actions make use of the same stage. In these cases, only the additions 
reported by the first
    +successful task contribute to the accumulator's value.
    --- End diff --
    
    @sryza Actually this is not true....
    
    scala> val acc = sc.accumulator(0)
    
    scala> val data = sc.parallelize(List(1, 2, 3))
    data: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[0] at 
parallelize at <console>:12
    
    scala> val a = data.map(x => acc += 1)
    
    scala> a.count
    
    scala> acc.value
    res5: Int = 3
    
    scala> a.count
    scala> acc.value
    res7: Int = 6
    
    I will resubmit https://github.com/apache/spark/pull/228 tonight or 
tomorrow, 



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to