nastra commented on code in PR #9008:
URL: https://github.com/apache/iceberg/pull/9008#discussion_r1672464813


##########
api/src/test/java/org/apache/iceberg/transforms/TestBucketing.java:
##########
@@ -165,6 +159,68 @@ public void testLong() {
         .isEqualTo(hashBytes(buffer.array()));
   }
 
+  @Test
+  public void testTimestampNanoPromotion() {
+    // Values from spec Appendix B: 32-bit Hash Requirements
+    String timestamp1 = "2017-11-16T22:31:08";
+    long expectedHash1 = -2047944441;
+    String timestamp2 = "2017-11-16T22:31:08.000001";
+    long expectedHash2 = -1207196810;
+    String timestampNs1 = "2017-11-16T22:31:08";
+    String timestampNs2 = "2017-11-16T22:31:08.000001001";
+
+    Types.TimestampType tsType = Types.TimestampType.withoutZone();
+    Types.TimestampNanoType tsNsType = Types.TimestampNanoType.withoutZone();
+
+    Bucket<Object> tsNsBucket = Bucket.get(tsNsType, 1);
+    Bucket<Object> tsBucket = Bucket.get(tsType, 1);
+
+    assertThat(tsBucket.hash(Literal.of(timestamp1).to(tsType).value()))
+        .as("Timestamp and TimestampNano bucket results should match")

Review Comment:
   this and other places in this test should be updated to `.as("Spec example: 
...")` to clearly indicate that this is testing the examples from the spec



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to