You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2018/12/17 17:37:15 UTC

[GitHub] dongjoon-hyun commented on a change in pull request #23334: [SPARK-26382][SQL] prefix comparator should handle -0.0

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org