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

    https://github.com/apache/spark/pull/10368#discussion_r48371027
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskResult.scala 
---
    @@ -46,6 +46,26 @@ class DirectTaskResult[T](var valueBytes: ByteBuffer, 
var accumUpdates: Map[Long
     
       def this() = this(null.asInstanceOf[ByteBuffer], null, null)
     
    +  override def toString: String = valueBytes.toString + " " + accumUpdates 
+ " " + metrics
    +
    +  override def equals(other: Any): Boolean = other match {
    +    case that: DirectTaskResult[_] => {
    +      if (!this.valueBytes.equals(that.valueBytes)) return false
    +
    +      val accumSize = if (accumUpdates != null) accumUpdates.size else 0
    +      val thatAccumSize = if (that.accumUpdates != null) 
that.accumUpdates.size else 0
    +      if (accumSize != thatAccumSize) return false
    +      if (accumSize > 0) {
    +        val b = this.accumUpdates.keys.forall { key =>
    +          this.accumUpdates.get(key) == that.accumUpdates.get(key)
    +        }
    +        if (!b) return false;
    +      }
    +      this.metrics.equals(that.metrics)
    +    }
    --- End diff --
    
    similarly, this can be simplified
    ```
    val accumEquals =
      if (accumUpdates != null) {
        accumUpdates.keys.forall { k => accumUpdates.get(k) == 
that.accumUpdates.get(k) }
      } else {
        that.accumUpdates == null
      }
      valueBytes.equals(that.valueBytes) &&
      metrics.equals(that.metrics) &&
      accumEquals
    ```


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