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

    https://github.com/apache/spark/pull/4115#discussion_r23248059
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala ---
    @@ -291,12 +309,61 @@ trait Row extends Seq[Any] with Serializable {
     
       /** Returns true if there are any NULL values in this row. */
       def anyNull: Boolean = {
    -    val l = length
    +    val len = length
         var i = 0
    -    while (i < l) {
    +    while (i < len) {
           if (isNullAt(i)) { return true }
           i += 1
         }
         false
       }
    +
    +  override def equals(that: Any): Boolean = that match {
    +    case null => false
    +    case that: Row =>
    +      if (this.length != that.length) {
    +        return false
    +      }
    +      var i = 0
    +      val len = this.length
    +      while (i < len) {
    +        if (apply(i) != that.apply(i)) {
    +          return false
    +        }
    +        i += 1
    +      }
    +      true
    +    case _ => false
    +  }
    +
    +  override def hashCode: Int = {
    +    // Using Scala's Seq hash code implementation.
    +    var n = 0
    +    var h = MurmurHash3.seqSeed
    +    val len = length
    +    while (n < len) {
    +      h = MurmurHash3.mix(h, apply(n).##)
    +      n += 1
    +    }
    +    MurmurHash3.finalizeHash(h, n)
    +  }
    +
    +  /* ---------------------- utility methods for Scala 
---------------------- */
    +
    +  /**
    +   * Return a Scala Seq representing the row. ELements are placed in the 
same order in the Seq.
    +   */
    +  def toSeq: Seq[Any]
    --- End diff --
    
    it's not that bad in that case since it just returns a wrappedarray. we can 
do it in a separate pr if we think it is important.


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