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

   ### Purpose of this pull request
   
   I am glad to contribute this fix to Apache SeaTunnel.
   
   Closes #13032.
   
   Generated HANA upserts currently use `MERGE INTO ... AS TARGET` and qualify 
the `SET` target with that alias. HANA 2.00.033 rejects this SQL, so a keyed 
JDBC sink cannot insert or update rows on that version.
   
   Generate an alias-free target instead: qualify the target in the `ON` 
predicate with its existing table identifier, and leave the assignment target 
unqualified. Keep the `SOURCE` alias, parameter order, insert behavior, and 
omission of `WHEN MATCHED` for primary-key-only tables. This is SQL 
construction only; it adds no queries or per-row work.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Generated HANA upserts also work on older HANA versions such as 
2.00.033. No options, defaults, or public APIs change. The English and Chinese 
JDBC sink documentation is updated.
   
   ### How was this patch tested?
   
   - Before the production fix, the three added dialect regression cases fail 
against `dev`; all five `SapHanaDialectTest` cases pass with the fix.
   - Scoped Maven `verify` passes: 32 HANA dialect/type-converter tests and 
compilation of `connector-jdbc-e2e-part-6` (native HANA Testcontainers 
execution was skipped).
   - Executed the actual generated SQL, with test values substituted for named 
parameters, on native HANA `2.00.033.00.1535711040`. The original aliased SQL 
fails, while the fix passes insert/update, NULL and empty-string transitions, 
repeated writes, composite keys, target-only/default-column preservation, and 
single/composite primary-key-only tables. The isolated schema was removed 
afterward. This checks native SQL syntax/behavior; it is separate from the 
prepared-statement integration test added here.
   - Extended the existing `JdbcHanaIT` with prepared-statement cases for 
schema-qualified/composite keys, NULL payloads, and primary-key-only tables.
   - `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]

Reply via email to