soumyajit-sahu opened a new issue, #15838:
URL: https://github.com/apache/iceberg/issues/15838

   ### Apache Iceberg version
   
   main (development)
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   The Iceberg Sink Connector fails with an unrecoverable 
DateTimeParseException when processing string-valued timestamp fields that have 
both sub-second precision and a colon-separated UTC offset (e.g. 
2026-03-31T03:17:37.260514+00:00). The connector task is killed.
   
   `java.time.format.DateTimeParseException: Text 
'2026-03-31T03:17:37.260514+00:00' could not be parsed, unparsed text found at 
index 26
        at 
java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2055)
        at 
java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1954)
        at java.base/java.time.LocalDateTime.parse(LocalDateTime.java:494)
        at 
org.apache.iceberg.connect.data.RecordConverter.parseOffsetDateTime(RecordConverter.java:490)
        at 
org.apache.iceberg.connect.data.RecordConverter.convertOffsetDateTime(RecordConverter.java:473)
        at 
org.apache.iceberg.connect.data.RecordConverter.convertTimestampValue(RecordConverter.java:462)
        at 
org.apache.iceberg.connect.data.RecordConverter.convertValue(RecordConverter.java:144)
        at 
org.apache.iceberg.connect.data.RecordConverter.lambda$convertToStruct$1(RecordConverter.java:244)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at 
java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092)
        at 
org.apache.iceberg.connect.data.RecordConverter.convertToStruct(RecordConverter.java:212)
        at 
org.apache.iceberg.connect.data.RecordConverter.convertStructValue(RecordConverter.java:157)
        at 
org.apache.iceberg.connect.data.RecordConverter.convert(RecordConverter.java:97)
        at 
org.apache.iceberg.connect.data.IcebergWriter.convertToRow(IcebergWriter.java:84)
        at 
org.apache.iceberg.connect.data.IcebergWriter.write(IcebergWriter.java:63)`
   
   This affects both timestamptz (TimestampType.withZone) and timestamp 
(TimestampType.withoutZone) Iceberg column types.
   
   A Fix:
   Replace the hardcoded index-19 check with a forward scan starting at index 
19, dynamically locating the timezone sign regardless of how many 
fractional-second digits precede it. The colon is then stripped at the correct 
position.
   Since both parseOffsetDateTime and parseLocalDateTime call 
ensureTimestampFormat, a single fix covers both timestamp types.
   
   ### Willingness to contribute
   
   - [x] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


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