epgif commented on code in PR #9008: URL: https://github.com/apache/iceberg/pull/9008#discussion_r1629891562
########## api/src/main/java/org/apache/iceberg/transforms/Transforms.java: ########## @@ -188,9 +198,15 @@ public static <T> Transform<T, Integer> day(Type type) { @Deprecated @SuppressWarnings("unchecked") public static <T> Transform<T, Integer> hour(Type type) { - Preconditions.checkArgument( - type.typeId() == Type.TypeID.TIMESTAMP, "Cannot partition type %s by hour", type); - return (Transform<T, Integer>) Timestamps.HOUR; + switch (type.typeId()) { + case TIMESTAMP: + return (Transform<T, Integer>) Timestamps.HOUR_FROM_MICROS; + case TIMESTAMP_NANO: + return (Transform<T, Integer>) Timestamps.HOUR_FROM_NANOS; + default: + throw new IllegalArgumentException( + Strings.lenientFormat("Cannot partition type %s by hour", type)); Review Comment: That was copied from Preconditions.checkArgument. Fixed. ########## api/src/main/java/org/apache/iceberg/util/DateTimeUtil.java: ########## @@ -75,6 +77,14 @@ public static long microsToMillis(long micros) { return Math.floorDiv(micros, MICROS_PER_MILLIS); } + public static long nanosToMicros(long nanos) { 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