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

    https://github.com/apache/spark/pull/9215#discussion_r42930194
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/metric/SQLMetrics.scala 
---
    @@ -62,7 +67,19 @@ private[sql] trait SQLMetricValue[T] extends 
Serializable {
     private[sql] class LongSQLMetricValue(private var _value : Long) extends 
SQLMetricValue[Long] {
     
       def add(incr: Long): LongSQLMetricValue = {
    -    _value += incr
    +    // Some LongSQLMetric will use -1 as initial value, so if the 
accumulator is never updated,
    +    // we can filter it out later.  However, when `add` is called, the 
accumulator is valid, we
    +    // should turn -1 to 0.
    +    if (_value < 0) {
    +      _value = 0
    +    }
    +
    +    // Some LongSQLMetric will use -1 as initial value, when we merge 
accumulator updates at driver
    +    // side, we should ignore these -1 values.
    +    if (incr > 0) {
    +      _value += incr
    +    }
    +
    --- End diff --
    
    I guess it is probably not worth that. The impact of those `-1` just too 
small (1048576 tasks for 1 MB). I think we can do that later. What do you think?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to