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

    https://github.com/apache/spark/pull/7194#discussion_r34954778
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala ---
    @@ -403,20 +403,30 @@ trait Row extends Serializable {
           if (!isNullAt(i)) {
             val o1 = get(i)
             val o2 = other.get(i)
    -        if (o1.isInstanceOf[Array[Byte]]) {
    -          // handle equality of Array[Byte]
    -          val b1 = o1.asInstanceOf[Array[Byte]]
    -          if (!o2.isInstanceOf[Array[Byte]] ||
    -            !java.util.Arrays.equals(b1, o2.asInstanceOf[Array[Byte]])) {
    +        o1 match {
    +          case b1: Array[Byte] =>
    +            if (!o2.isInstanceOf[Array[Byte]] ||
    +              !java.util.Arrays.equals(b1, o2.asInstanceOf[Array[Byte]])) {
    +              return false
    +            }
    +          case f1: Float =>
    +            if (!o2.isInstanceOf[Float] ||
    +              (java.lang.Float.isNaN(f1) && 
!java.lang.Float.isNaN(o2.asInstanceOf[Float]))) {
    --- End diff --
    
    actually, I don't think that we can use nanSafeCompare without breaking 
existing test code / user code: the old code would allow integers and floats to 
be compared because Java would handle implicit type conversions.  Therefore, 
for compatibility I think we need to do the same here.
    
    I think it will be clearer to rework this as something like "if f1 is a 
float and it's NaN, then the other value had better be a NaN float, otherwise 
fall back to the regular `==` branch).


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