Fokko commented on code in PR #17579:
URL: https://github.com/apache/iceberg/pull/17579#discussion_r3986816741
##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkUtil.java:
##########
@@ -249,6 +252,25 @@ 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"), defaulting any missing time fields to zero.
+ private static final DateTimeFormatter LENIENT_ISO_DATE_TIME =
+ new DateTimeFormatterBuilder()
+ .append(DateTimeFormatter.ISO_LOCAL_DATE)
+ .optionalStart()
+ .appendLiteral('T')
+ .append(DateTimeFormatter.ISO_LOCAL_TIME)
+ .optionalEnd()
+ .parseDefaulting(ChronoField.HOUR_OF_DAY, 0)
+ .parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0)
+ .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
+ .toFormatter();
+
+ private static long parseToEpochMillis(String value) {
Review Comment:
I've extended the parser, and also threw in a few tests 👍
--
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]