goutamadwant opened a new pull request, #13025:
URL: https://github.com/apache/seatunnel/pull/13025
### Purpose of this pull request
This contribution fixes #13024.
The JDBC source reads MySQL `DATETIME` as `LocalDateTime`, but the sink
converts it through `Timestamp.valueOf()` before binding. When worker and
connection time zones differ, this can shift local fields, normalize DST gaps,
or reject valid boundary values.
- Add a protected timestamp writer with the existing shared binding as its
default; bind `LocalDateTime` directly in the MySQL converter.
- Preserve StarRocks binding explicitly and retain existing source mappings,
`TIME`, and `TIMESTAMP_TZ` behavior.
- Extend the existing converter and MySQL integration tests.
- Update English/Chinese sink and upgrade documentation.
### Does this PR introduce _any_ user-facing change?
Yes. MySQL `DATETIME` writes preserve local date/time fields and
target-supported fractional seconds when JVM and connection time zones differ.
No new configuration or dependency is required.
Remove manual offsets previously used to compensate for this defect.
Existing stored values are not repaired automatically; compare them with the
original source before correction or reload.
The bug was reproduced on current `dev`. Its reported introduction between
2.3.13 and 3.0.0 was not independently bisected.
### How was this patch tested?
Local validation with MySQL 8.0.43:
- Before the fix, the new unit regressions failed. A 216-case database
matrix produced 336 incorrect stored values plus 36 cases with SQL errors at
valid boundaries.
- After the fix, all 216 cases / 1,944 values passed in each of these
environments:
- JDK 17 / Connector-J 8.0.27 / DATETIME(6)
- JDK 11 / Connector-J 8.0.27 / DATETIME(6)
- JDK 17 / Connector-J 8.0.32 / DATETIME(6)
- JDK 17 / Connector-J 8.0.27 / DATETIME(0)
- The matrix covers independent JVM/connection zones (UTC, Asia/Shanghai,
America/New_York), client/server preparation, `preserveInstants`,
single/batch/rewritten execution, and JDBC-read/direct inputs. Values include
microseconds, NULL, pre-epoch dates, DST gaps/overlaps, rollovers, and years
1000/9999.
- JDBC unit suite: 1,127 tests, zero failures/errors, six existing skips.
Oracle/Kingbase container packages were excluded because fixture setup stalled.
- Existing MySQL timestamp integration suite: four tests passed on Zeta with
UTC workers, four with Asia/Shanghai workers, and four on Flink 1.20. The added
round trip checks destination fields and instants independently using SQL
`DATE_FORMAT` and `UNIX_TIMESTAMP`.
- 46 Iceberg compatibility tests and a JDBC → Iceberg → MySQL round trip
passed.
- Spotless and `git diff --check` passed.
- Root verification reached successful distribution packaging across Maven
resumes with tests and UI skipped. This was not an uninterrupted clean build or
a full project test run. Spark E2E was not run because this timestamp suite
excludes Spark for its TIMESTAMP_TZ restriction.
Repeat the JDBC unit suite with:
```shell
./mvnw -o -B -pl seatunnel-connectors-v2/connector-jdbc
'-Dtest=*,!**/container/*' -DskipUT=false -DskipIT=true test
```
For the permanent database regression, run `JdbcMysqlTimestampIT` with UTC
and Asia/Shanghai worker JVMs. `testMysqlDatetimeRoundTrip` runs both
connection zones with client and server preparation.
### 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)
* [x] If necessary, please update the documentation to describe the new
feature.
* [x] 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` and add new connector information.
2. Update the pom file of `seatunnel-dist`.
3. Add CI label in `label-scope-conf`.
4. Add E2E testcase in `seatunnel-e2e`.
5. Update connector `plugin_config`.
Checklist applicability: no new JAR or connector is added. Connector
registration, distribution dependencies, CI labels, and plugin configuration do
not require changes; the existing JDBC integration test is extended.
--
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]