Fokko commented on code in PR #8971: URL: https://github.com/apache/iceberg/pull/8971#discussion_r1381242855
########## api/src/main/java/org/apache/iceberg/transforms/Transforms.java: ########## @@ -129,10 +131,14 @@ public static <T> Transform<T, Integer> year(Type type) { case DATE: return (Transform<T, Integer>) Dates.YEAR; case TIMESTAMP: - return (Transform<T, Integer>) Timestamps.YEAR; - default: - throw new IllegalArgumentException("Cannot partition type " + type + " by year"); + switch (((TimestampType) type).unit()) { + case MICROS: + return (Transform<T, Integer>) Timestamps.YEAR_FROM_MICROS; + case NANOS: + return (Transform<T, Integer>) Timestamps.YEAR_FROM_NANOS; + } } + throw new IllegalArgumentException("Cannot partition type " + type + " by year"); Review Comment: Nit: I think how it was previously, with the `default` reads better -- 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