spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-15080][CORE] Break copyAndReset into co...
Date Wed, 11 May 2016 02:56:17 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12936#discussion_r62785888
  
    --- Diff: core/src/main/scala/org/apache/spark/util/AccumulatorV2.scala ---
    @@ -112,7 +112,18 @@ abstract class AccumulatorV2[IN, OUT] extends Serializable {
        * Creates a new copy of this accumulator, which is zero value. i.e. call `isZero`
on the copy
        * must return true.
        */
    -  def copyAndReset(): AccumulatorV2[IN, OUT]
    +  def copyAndReset(): AccumulatorV2[IN, OUT] = copy().reset()
    +
    +  /**
    +   * Creates a new copy of this accumulator.
    +   */
    +  def copy(): AccumulatorV2[IN, OUT]
    +
    +  /**
    +   * Resets this accumulator, which is zero value. i.e. call `isZero` must
    +   * return true.
    +   */
    +  def reset(): AccumulatorV2[IN, OUT]
    --- End diff --
    
    I know this can save some line of code, but I prefer to define it as `def reset(): Unit`,
which matches its semantic better.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message