rdblue commented on code in PR #4871:
URL: https://github.com/apache/iceberg/pull/4871#discussion_r892938544


##########
core/src/main/java/org/apache/iceberg/util/DateTimeUtil.java:
##########
@@ -88,4 +88,25 @@ 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 formatEpochDays(int days) {
+    return LocalDate.ofEpochDay(days).format(DateTimeFormatter.ISO_LOCAL_DATE);
+  }
+
+  public static String formatTimeOfDayMicros(long micros) {
+    return LocalTime.ofNanoOfDay(micros * 
1000).format(DateTimeFormatter.ISO_LOCAL_TIME);
+  }
+
+  public static String formatEpochTimeMicros(long micros, boolean withUTCZone) 
{
+    String localDateTime = LocalDateTime.ofEpochSecond(micros / 1000000,
+        (int) (micros % 1000000) * 1000, 
ZoneOffset.UTC).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
+    if (withUTCZone) {
+      // We standardize the format by always using the UTC zone
+      return LocalDateTime.parse(localDateTime, 
DateTimeFormatter.ISO_LOCAL_DATE_TIME)

Review Comment:
   This should not produce a string and then parse it. Instead, it should 
update the conversion above to go directly.



-- 
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]

Reply via email to