epgif commented on code in PR #9008: URL: https://github.com/apache/iceberg/pull/9008#discussion_r1674135249
########## 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: done -- 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