github-actions[bot] commented on code in PR #40861:
URL: https://github.com/apache/beam/pull/40861#discussion_r4397160283


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergUtils.java:
##########
@@ -88,6 +92,22 @@ private IcebergUtils() {}
           .put(EnumerationType.IDENTIFIER, Types.StringType.get())
           .build();
 
+  private static final DateTimeFormatter TIMESTAMP_SPACE_FORMATTER =
+      new DateTimeFormatterBuilder()
+          .parseCaseInsensitive()
+          .append(ISO_LOCAL_DATE)
+          .appendLiteral(' ')
+          .append(ISO_LOCAL_TIME)
+          .toFormatter();

Review Comment:
   **🟡 Medium**: `DateTimeFormatterBuilder.toFormatter()` defaults to 
`ResolverStyle.SMART` (and `null` chronology), whereas 
`DateTimeFormatter.ISO_LOCAL_DATE_TIME` and 
`DateTimeFormatter.ISO_OFFSET_DATE_TIME` (used by 
`LocalDateTime.parse(CharSequence)` and `OffsetDateTime.parse(CharSequence)`) 
use `ResolverStyle.STRICT` with `IsoChronology.INSTANCE`.
   
   With `ResolverStyle.SMART`, invalid calendar dates in space-separated inputs 
(e.g., `"2024-02-30 13:18:20"` or `"2023-02-29 13:18:20"`) will silently clamp 
to the last valid day of the month (`2024-02-29` / `2023-02-28`) instead of 
throwing `DateTimeParseException` as the `T`-separated path does. Setting 
`.withResolverStyle(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE)`
 on both `TIMESTAMP_SPACE_FORMATTER` and `TIMESTAMPTZ_SPACE_FORMATTER` keeps 
validation behavior identical between `' '` and `'T'` separators.



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

Reply via email to