nastra commented on code in PR #17579:
URL: https://github.com/apache/iceberg/pull/17579#discussion_r3989615614


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkUtil.java:
##########
@@ -249,6 +254,36 @@ public static List<Expression> partitionMapToExpression(
     return filterExpressions;
   }
 
+  // Lenient ISO parser accepting either a date (e.g. "2021-01-01") or a 
date-time
+  // (e.g. "2021-01-01T12:34:56"), with an optional zone offset (e.g. 
"2021-01-01T12:34:56Z" or
+  // "2021-01-01T12:34:56+00:00"), defaulting any missing time fields to zero.
+  private static final DateTimeFormatter LENIENT_ISO_DATE_TIME =

Review Comment:
   one potential alternative to explore might be
   ```
   private static long parseToEpochMillis(String value) {
     try {
       return OffsetDateTime.parse(value).toInstant().toEpochMilli();
     } catch (DateTimeParseException ignored) {
       return LocalDateTime.parse(value)
           .atZone(ZoneId.systemDefault())
           .toInstant()
           .toEpochMilli();
     }
   }
   ```
   
   that way we don't have to maintain a separate formatter



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