DanielLeens commented on PR #13513:
URL: https://github.com/apache/seatunnel/pull/13513#issuecomment-7225589741

   ## Implementation Notes and Trade-offs
   
   Applicable PR head: `b6be50e1905a83c2f3ed44cb69c9ad4ed4a63e2c`.
   
   The call chain is JdbcSink → JdbcSinkWriter → JdbcOutputFormatBuilder → 
generated statement executor → SqlserverDmlRowConverter → Microsoft JDBC. The 
private selector changes only the exact built-in SQL Server dialect's generated 
DML. Source conversion, custom SQL, DELETE and custom dialects retain their 
previous converter. The original SqlserverJdbcRowConverter remains 
byte-for-byte unchanged.
   
   The selected implementation supplies a declared scale only for decimal NULLs 
with confirmed DECIMAL/NUMERIC destination metadata and a representable logical 
scale. A dedicated stateless converter keeps this database-specific rule out of 
the general conversion contract. Non-null BigDecimal values are not rescaled or 
rounded; all other setters delegate unchanged.
   
   Alternatives evaluated:
   
   - A global decimal-NULL change was rejected after actual custom ISNULL and 
decimal-to-DATE NULL regressions. Generated SQL alone is insufficient; the 
destination type guard is necessary. Unknown metadata deliberately retains 
legacy behavior.
   - setNull(Types.DECIMAL) alone was rejected because the tested driver still 
declares scale zero and fragments the batch.
   - Copying DataX's setString behavior for all numeric values was rejected 
because it changes existing non-null numeric binding and conversions beyond the 
measured NULL defect.
   - Direct Bulk Copy is a different execution path, proposed in #10099; it is 
not required to fix ordinary JDBC batch declarations.
   
   Assumptions and limits: the optimization requires the built-in dialect and 
recognizable target decimal metadata. It does not promise improvement for 
custom SQL, unknown/other target types, other drivers/versions, or different 
workloads. The fixed fixture normalizes booleans to 0/1 small integers and 
covers millisecond timestamps, not native boolean or micro/nanosecond fidelity.
   
   Evidence: baseline full 3 pairs and independent component 3 pairs qualify 
above 1.20 with exact values. Final generated-DML INSERT/MERGE/UPDATE 
regression has 23 server response packets against baseline 1011; custom SQL and 
DATE/unknown target NULL regressions pass. Final full 3 pairs each reconcile 
1,000,000 x 19 values and are all below 1.20. First-round slower DataX control 
is retained in the table. Formatting, affected compilation,13 existing tests, 
final E 2 E package and real-JDBC replays are recorded in the PR. The runtime's 
two changed classes byte-match the standard packaged artifact, and all other 
baseline classes/dependencies are retained.
   
   Unverified: full standard Testcontainers startup/lifecycle remains for 
GitHub CI. Local UI was excluded because unchanged; no public API, 
config/default, dependency, POM, registration, schema or serialization-contract 
change is intended. No merge or deployment is implied by this PR.
   


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