rdblue commented on code in PR #9008: URL: https://github.com/apache/iceberg/pull/9008#discussion_r1421812388
########## api/src/main/java/org/apache/iceberg/expressions/Literals.java: ########## @@ -426,16 +428,40 @@ protected Type.TypeID typeId() { } static class TimestampLiteral extends ComparableLiteral<Long> { - TimestampLiteral(Long value) { + private final ChronoUnit unit; + + TimestampLiteral(ChronoUnit unit, Long value) { super(value); + this.unit = unit; } @Override @SuppressWarnings("unchecked") public <T> Literal<T> to(Type type) { switch (type.typeId()) { case TIMESTAMP: - return (Literal<T>) this; + ChronoUnit toUnit = ((TimestampType) type).unit(); + switch (unit) { + case MICROS: Review Comment: I thought that micros was not a supported unit. Why would `TimestampType` use it? ########## api/src/main/java/org/apache/iceberg/expressions/Literals.java: ########## @@ -426,16 +428,40 @@ protected Type.TypeID typeId() { } static class TimestampLiteral extends ComparableLiteral<Long> { - TimestampLiteral(Long value) { + private final ChronoUnit unit; + + TimestampLiteral(ChronoUnit unit, Long value) { super(value); + this.unit = unit; } @Override @SuppressWarnings("unchecked") public <T> Literal<T> to(Type type) { switch (type.typeId()) { case TIMESTAMP: - return (Literal<T>) this; + ChronoUnit toUnit = ((TimestampType) type).unit(); + switch (unit) { + case MICROS: Review Comment: I thought that micros was not a supported unit. Why would `TimestampType` use it? -- 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