[Feature][Connector-V2][Jdbc] MySQL support read TIMESTAMP_TZ with server_time_zone
https://github.com/apache/seatunnel/issues/9785
Purpose of this pull request
-
Add the server_time_zone option to the JDBC source/sink, and thread this option through JdbcConnectionConfig, SimpleJdbcConnectionProvider, and `MysqlDialect. This ensures that the MySQL JDBC driver and row converter use a consistent session time zone, thereby avoiding the 8-hour time difference issue.
-
Add TIMESTAMP_TZ read support for MySQL: SeaTunnel TIMESTAMP_TZ is read as OffsetDateTime using the configured server_time_zone (or system default as fallback).
Does this PR introduce any user-facing change?
Yes, but scope is limited:
-
MySQL DATETIME mapping is kept as TIMESTAMP (LOCAL_DATE_TIME_TYPE) for backward compatibility.
-
MySQL TIMESTAMP columns are now exposed as TIMESTAMP_TZ (OFFSET_DATE_TIME_TYPE) instead of TIMESTAMP to align with timezone-aware semantics and the new server_time_zone option.
-
New configuration option server_time_zone is added to JDBC source and sink; when set, it controls both JDBC driver conversion and TIMESTAMP_TZ conversion in the MySQL row converter.
How was this patch tested?
Unit tests:
-
Updated MySqlTypeConverterTest to cover DATETIME/TIMESTAMP/TIMESTAMP_TZ mappings.
-
Added MysqlJdbcRowConverterTest for TIMESTAMP_TZ reading with system default zone.
-
Added SimpleJdbcConnectionProviderTest to verify server_time_zone is correctly translated to the MySQL driver serverTimezone property and not overridden when user sets it explicitly.
E2E:
- Added jdbc_mysql_source_and_sink_server_time_zone.conf and JdbcMysqlIT uses it to validate server_time_zone through real MySQL containers (TIMESTAMP/TIMESTAMP_TZ round trip).
Check list
- [ ] If any new Jar binary package adding in your PR, please add License Notice according New License Guide
- [ * ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
- [ ] If you are contributing the connector code, please check that the following files are updated:
- Update plugin-mapping.properties and add new connector information in it
- Update the pom file of seatunnel-dist
- Add ci label in label-scope-conf
- Add e2e testcase in seatunnel-e2e
- Update connector plugin_config