You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/11/03 17:41:32 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #6110: API: Hash floats -0.0 and 0.0 to the same bucket

rdblue commented on code in PR #6110:
URL: https://github.com/apache/iceberg/pull/6110#discussion_r1013224969


##########
api/src/test/java/org/apache/iceberg/transforms/TestBucketing.java:
##########
@@ -65,10 +65,17 @@ public void testSpecValues() {
     Assert.assertEquals("Spec example: hash(true) = 1392991556", 1392991556, BucketUtil.hash(1));
     Assert.assertEquals("Spec example: hash(34) = 2017239379", 2017239379, BucketUtil.hash(34));
     Assert.assertEquals("Spec example: hash(34L) = 2017239379", 2017239379, BucketUtil.hash(34L));
+
     Assert.assertEquals(
         "Spec example: hash(17.11F) = -142385009", -142385009, BucketUtil.hash(1.0F));
     Assert.assertEquals(
         "Spec example: hash(17.11D) = -142385009", -142385009, BucketUtil.hash(1.0D));
+    Assert.assertEquals("Spec example: hash(0.0F) = 1669671676", 1669671676, BucketUtil.hash(0.0F));
+    Assert.assertEquals(
+        "Spec example: hash(-0.0F) = 1669671676", 1669671676, BucketUtil.hash(-0.0F));
+    Assert.assertEquals("Spec example: hash(0.0) = 1669671676", 1669671676, BucketUtil.hash(0.0));
+    Assert.assertEquals("Spec example: hash(-0.0) = 1669671676", 1669671676, BucketUtil.hash(-0.0));

Review Comment:
   Can you add NaN tests as well since this updates the spec for NaN, too?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org