rdblue commented on code in PR #4871:
URL: https://github.com/apache/iceberg/pull/4871#discussion_r896341253
##########
core/src/main/java/org/apache/iceberg/util/DateTimeUtil.java:
##########
@@ -88,4 +88,40 @@ public static long microsFromTimestamptz(OffsetDateTime
dateTime) {
public static String formatTimestampMillis(long millis) {
return
DATE_FORMAT.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(millis),
ZoneOffset.UTC));
}
+
+ public static String daysToIsoDate(int days) {
+ return LocalDate.ofEpochDay(days).format(DateTimeFormatter.ISO_LOCAL_DATE);
+ }
+
+ public static String microsToIsoTime(long micros) {
+ return LocalTime.ofNanoOfDay(micros *
1000).format(DateTimeFormatter.ISO_LOCAL_TIME);
+ }
+
+ public static String microsToIsoDateTimeTz(long micros) {
+ LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(micros / 1000000,
+ (int) (micros % 1000000) * 1000, ZoneOffset.UTC);
Review Comment:
This conversion isn't safe. Can you update this to use `timestampFromMicros`
and `timestamptzFromMicros` instead? The problem here is that this doesn't use
`floorMod` and `floorDiv` so it handles negative values incorrectly.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]