JacobZheng0927 opened a new pull request, #13037: URL: https://github.com/apache/seatunnel/pull/13037
### Purpose of this pull request I am glad to contribute this fix to Apache SeaTunnel. Closes #13036. Generated DB2 MERGE statements currently compare columns with `<>` to skip unchanged rows. NULL transitions make those comparisons UNKNOWN, so a matched row can silently retain its old value. Use `DECODE(target.column, source.column, 0, 1) = 1` for the existing change guard. DB2 DECODE considers two NULL arguments equal, so both directions of a NULL transition update the row while equal values and two NULLs remain no-ops. The join, assignments, insert behavior, and positional parameter order are unchanged. This preserves DB2 10.5 compatibility, keeps the existing unchanged-row guard, and adds no statements, database round trips, or scans. The predicate still compares each field once; no comparative performance benchmark is claimed. See the [IBM DECODE reference](https://www.ibm.com/docs/en/db2/11.5?topic=functions-decode). ### Does this PR introduce _any_ user-facing change? Yes. Generated DB2 upserts correctly clear and refill nullable fields. Unchanged rows still avoid firing UPDATE triggers. No options, defaults, or public APIs change. English and Chinese JDBC sink documentation is updated. ### How was this patch tested? - The updated dialect regression fails against original `dev` and passes with the fix, checking the complete generated SQL and unchanged parameter order. - Scoped Maven `verify` passes: DB2 dialect/catalog unit tests (3 tests) and compilation of `connector-jdbc-e2e-part-1`. - Extended existing `JdbcDb2UpsertIT` with a native PreparedStatement regression: first-row NULL binding, independent string/integer/boolean/binary/date transitions in both directions, equal replays, ordinary updates, inserts, and an UPDATE-count trigger to distinguish no-op writes. - Native DB2 10.5.0.11: executed the actual generated positional-parameter MERGE through SQL PL `PREPARE`/`EXECUTE USING`. The original guard reproduces the lost NULL update. The fix passes 23 checks, including first-NULL preparation, independent text/integer/smallint/bit-data/date NULL transitions, equal values, equal NULLs, unequal values, inserts, replay, and an UPDATE-count trigger. Binary data uses the 10.5-compatible `VARCHAR FOR BIT DATA` type. The isolated table, trigger and schema were removed. The separate DB2 11.5 Testcontainers run was stopped while its image pull remained incomplete; that Java integration case is compiled but not claimed as executed. - `spotless:apply` and `git diff --check` pass. Based on current `dev` (`cec3276740d9`); open and closed PR searches found no same-purpose change. ### Check list * [x] Updated English and Chinese connector documentation. * [x] Extended existing unit and JDBC integration tests. * [x] No new dependencies, configuration options, or incompatible changes. -- 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]
