JacobZheng0927 opened a new pull request, #11891:
URL: https://github.com/apache/seatunnel/pull/11891

   ### Purpose of this pull request
   
   JDBC `TIME` values can lose fractional seconds when they pass through 
`java.sql.Time`, which stores only whole seconds. This affects MySQL and 
PostgreSQL reads, PostgreSQL writes, and PostgreSQL COPY serialization.
   
   This patch uses `LocalTime` for JDBC 4.2 reads and PostgreSQL writes, 
preserves the textual `LocalTime` value for COPY, and provides text fallbacks 
for drivers that do not support `getObject(index, LocalTime.class)`.
   
   PostgreSQL 9.6 can expose `timetz` text with a short offset such as `+08`; 
the fallback normalizes that suffix before parsing while retaining the 
wall-clock time and fractional seconds.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, as a bug fix. JDBC TIME values with fractional seconds are now 
preserved instead of being truncated to whole seconds.
   
   ### How was this patch tested?
   
   Added unit coverage for MySQL and PostgreSQL TIME conversion, PostgreSQL 
TIMETZ fallback handling, PostgreSQL COPY text serialization, and invalid 
fallback values.
   
   Validated locally with JDK 8 against real databases:
   
   * MySQL 8.0.11: a `TIME(6)` value written and read through 
`MysqlJdbcRowConverter` remained `12:34:56.123456`.
   * PostgreSQL 9.6.8: `time(6)`, `timetz(6)` returned as `12:34:56.123456+08`, 
and COPY input all preserved `12:34:56.123456` through the connector code.
   
   Focused regression tests after the PostgreSQL short-offset fix: 11 tests 
run, 0 failures, 0 errors. Spotless check also passed.
   
   ### Check list
   
   * [x] No new Jar binary package is added.
   * [x] Documentation and incompatible-change updates are not required for 
this bug fix.
   * [x] No new connector, plugin mapping, distribution dependency, or 
connector configuration is required.
   


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

Reply via email to