nastra commented on code in PR #9008: URL: https://github.com/apache/iceberg/pull/9008#discussion_r1669903058
########## api/src/test/java/org/apache/iceberg/transforms/TestBucketing.java: ########## @@ -112,12 +112,59 @@ public void testSpecValues() { .as("Spec example: hash(2017-11-16T22:31:08) = -2047944441") .isEqualTo(-2047944441); + timestampVal = Literal.of("2017-11-16T22:31:08.000001").to(Types.TimestampType.withoutZone()); + assertThat(BucketUtil.hash(timestampVal.value())) + .as("Spec example: hash(2017-11-16T22:31:08.000001) = -1207196810") + .isEqualTo(-1207196810); + Literal<Long> timestamptzVal = Literal.of("2017-11-16T14:31:08-08:00").to(Types.TimestampType.withZone()); assertThat(BucketUtil.hash(timestamptzVal.value())) .as("Spec example: hash(2017-11-16T14:31:08-08:00) = -2047944441") .isEqualTo(-2047944441); + timestamptzVal = + Literal.of("2017-11-16T14:31:08.000001-08:00").to(Types.TimestampType.withZone()); + assertThat(BucketUtil.hash(timestamptzVal.value())) + .as("Spec example: hash(2017-11-16T14:31:08.000001-08:00) = -1207196810") + .isEqualTo(-1207196810); + + Literal<Long> timestampNsVal = + Literal.of("2017-11-16T22:31:08").to(Types.TimestampNanoType.withoutZone()); + assertThat(BucketUtil.hash(timestampNsVal.value())) + .as("Spec example: hash(2017-11-16T22:31:08) = -737750069") Review Comment: do we have tests that refer to the examples in 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