ebyhr commented on code in PR #11775: URL: https://github.com/apache/iceberg/pull/11775#discussion_r1887709351
########## api/src/test/java/org/apache/iceberg/types/TestConversions.java: ########## @@ -111,9 +111,9 @@ public void testByteBufferConversions() { assertConversion( 400000000L, TimestampNanoType.withZone(), new byte[] {0, -124, -41, 23, 0, 0, 0, 0}); assertThat(Literal.of(400000L).to(TimestampNanoType.withoutZone()).toByteBuffer().array()) - .isEqualTo(new byte[] {0, -124, -41, 23, 0, 0, 0, 0}); + .isEqualTo(new byte[] {-128, 26, 6, 0, 0, 0, 0, 0}); assertThat(Literal.of(400000L).to(TimestampNanoType.withZone()).toByteBuffer().array()) Review Comment: I think the cause is the original logic called `DateTimeUtil.microsToNanos` method which multiples the value by 1000: https://github.com/apache/iceberg/blob/b9b61b1d72ebb192d5e90453ff7030ece73d2603/api/src/main/java/org/apache/iceberg/expressions/Literals.java#L444-L445 ########## api/src/test/java/org/apache/iceberg/expressions/TestTimestampLiteralConversions.java: ########## @@ -107,6 +108,28 @@ public void testTimestampMicrosToDateConversion() { assertThat(dateOrdinal).isEqualTo(-1); } + @Test + public void testTimestampNanoWithLongLiteral() { Review Comment: Sure, added the test case. -- 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