ricky2129 opened a new pull request, #12957:
URL: https://github.com/apache/seatunnel/pull/12957
### Purpose of this pull request
Fixes #12955.
`SeaTunnelRowDebeziumDeserializationConverters#convertToTimestamp` split
Debezium `MicroTimestamp` / `NanoTimestamp` epoch values with `/` and `%`. Both
round toward zero, so a negative (pre-1970) value with a sub-millisecond part
produced a negative nano-of-milli. For example, `-1` micro gave millis `0` and
nanos `-1000`, and `LocalTime.ofNanoOfDay` threw `DateTimeException`, failing
the job. `Math.floorDiv` / `Math.floorMod` keep the sub-millisecond part in
`[0, 1000)` µs. `toLocalDateTime(long, int)` already handles negative millis.
### Does this PR introduce _any_ user-facing change?
Pre-1970 `DATETIME(4..6)` (and other `MicroTimestamp` / `NanoTimestamp`)
values are now read instead of failing the job. Other values are unchanged.
### How was this patch tested?
Added
`SeaTunnelRowDebeziumDeserializationConvertersTest#testTimestampConverterBeforeEpoch`.
It runs `Timestamp`, `MicroTimestamp` and `NanoTimestamp` fields through the
converter, with values encoded the way Debezium floors them:
`2026-04-27T20:50:29.006733123`, `1970-01-01T00:00`,
`1969-12-31T23:59:59.999999999`, `1969-12-31T12:00:00.5`,
`1900-06-15T12:30:45.123456789`, `1000-01-01T00:00`. Nanos are only set for
years 1678 to 2261, the range a long of epoch nanos covers. Putting back `/`
and `%` in either branch fails the test.
End to end on 2.3.12: MySQL 8.4 `DATETIME(6)` rows `1969-12-31
23:59:59.999999`, `1900-06-15 12:30:45.123456` and `1969-12-31 12:00:00.5`
through MySQL-CDC (snapshot + binlog) → LocalFile. Without the patch the job
fails with the trace in the issue. With it, all rows match MySQL.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [ ] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the
following files are updated:
1. Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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]