dongjoon-hyun commented on a change in pull request #23334: [SPARK-26382][SQL] 
prefix comparator should handle -0.0
URL: https://github.com/apache/spark/pull/23334#discussion_r242245754
 
 

 ##########
 File path: 
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/PrefixComparators.java
 ##########
 @@ -69,6 +69,8 @@ public static long computePrefix(byte[] bytes) {
      * details see http://stereopsis.com/radix.html.
      */
     public static long computePrefix(double value) {
+      // normalize -0.0 to 0.0, as they should be equal
+      value = value == -0.0 ? 0.0 : value;
 
 Review comment:
   Technically, `value == -0.0` is `true` for both `0.0` and `-0.0`, but the 
current one is the simplest one for this normalization. We don't need to 
exclude `0.0` here. +1 for the logic.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to