DanielLeens commented on PR #13678: URL: https://github.com/apache/seatunnel/pull/13678#issuecomment-7243737253
### Implementation Notes and Trade-offs Applies to head `81b2b7cbaa510a5bd3a981116937c5b58f488bcb`, based on dev `0bef81d003a9dcc3266a10140dc639534ad81bfd`. Yes, I am contributing to Apache SeaTunnel. Related issue: #13660. **Problem and placement.** The BLOB-compatible JDBC STRING path introduced by #9305 invokes `getObject` and then `getString` for non-BLOB results. Connector/J decodes textual values in both getters. The patch introduces a protected hook with the existing generic behavior as its default, and specializes only the exact MySQL converter when optional metadata identifies the driver's object class as `java.lang.String`. The specialization calls `getString` directly; unknown metadata retains the original BLOB decoding/freeing path. Only metadata SQLExceptions select that original path; actual value-access failures still propagate. **Compatibility and alternatives.** Unconditionally reusing the String returned by `getObject` was rejected: Connector/J's `clobCharacterEncoding` can make it differ from `getString`. Changing the shared helper globally was rejected because other dialects, BLOBs and no-metadata cursors have different contracts. An experimental metadata cache added less than 1% benefit in the component diagnostic and was omitted. The stateless implementation retains subclass behavior, including StarRocks, and explicitly preserves the original Abstract/MySQL serialization UIDs. Six existing files change, including existing UT/IT and both source guides. There are no POM/dependency, default, public SPI, batching, transaction, retry, schema or registration changes. **Validation and assumptions.** Fresh baseline/candidate affected reactors passed formatting and verification with 1,850/1,853 non-container tests, respectively, zero failures/errors and five existing skips. Four Oracle/Kingbase Docker-only classes were explicitly excluded because that environment was unavailable; none of their assertions changed. The unchanged engine UI was excluded. Both actual artifacts passed the added public MySQL converter IT method against isolated MySQL 8.0.35/Connector-J 8.0.33, preserving Unicode, empty and NULL values with different connection/CLOB encodings. Baseline serialization to candidate deserialization and subsequent serialization passed for MySQL and Generic converters. Full Testcontainers startup/teardown was not run. UTs cover unavailable metadata, BLOB decoding/release, subclass isolation and switching ResultSets. The optimization depends on the driver advertising String metadata; otherwise it retains the original path. **Measured benefit and limits.** Three alternating real-JDBC diagnostics each checked one million rows with seven string fields against a separate reference cursor. Allocations around public `toInternal` fell by 39.98–40.00%, and conversion time fell by 30.74–38.13%. Cursor advancement/reference getters were outside that component timer. Each fresh measured JVM had a preceding host/database warmup, not a same-JVM JIT warmup. A distinct older-engine, full 19-field MySQL-to-Elasticsearch experiment retained all three triplets: candidate throughput changes versus its matching SeaTunnel baseline were -0.27%, +7.66% and +3.85%; it did not beat DataX in every triplet. The source allocation result does not imply a guaranteed complete-job improvement or completion of the broader performance goal. The PR body preserves exact times, pins and verification commands. One independent Maintainer reviewed this head's behavior, compatibility, tests and scope. Current-head GitHub CI and the full container lifecycle remain separate validation/merge gates; this comment does not assert CI success or production readiness. -- 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]
