Skip to content

Sink connector crashes on timestamps with fractional seconds and colon-separated UTC offset (Fixes #15838)#15839

Open
soumyajit-sahu wants to merge 2 commits intoapache:mainfrom
soumyajit-sahu:fix_fractional_seconds_kafka_connect
Open

Sink connector crashes on timestamps with fractional seconds and colon-separated UTC offset (Fixes #15838)#15839
soumyajit-sahu wants to merge 2 commits intoapache:mainfrom
soumyajit-sahu:fix_fractional_seconds_kafka_connect

Conversation

@soumyajit-sahu
Copy link
Copy Markdown

ensureTimestampFormat normalizes colon-separated offsets (+00:00 → +0000) so that the internal OFFSET_TIMESTAMP_FORMAT formatter (which uses appendOffset("+HHmm", "Z")) can parse them. However, it assumed the timezone sign is always at character index 19 — which is only true when there are no fractional seconds.

When the normalization was skipped, OFFSET_TIMESTAMP_FORMAT failed to parse the string (colon still present). The fallback LocalDateTime.parse with ISO_LOCAL_DATE_TIME then also failed because the +00:00 suffix was still attached. The combined failure produced a connector task crash.

This change replaces 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.

Closes #15838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kafka Connect: Sink connector crashes on timestamps with fractional seconds and colon-separated UTC offset (+HH:MM)

1 participant