You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "hutiefang76 (via GitHub)" <gi...@apache.org> on 2026/09/28 13:26:21 UTC

[PR] [Fix][Connector-V2] Bind JDBC parameters using complete field names [seatunnel]

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

   ### Purpose of this pull request
   
   Fixes #12517. Generated JDBC statements currently fail for correctly quoted columns such as `field?question`, `field name`, `field:colon`, and `field"quote`: `sql.contains("?")` selects positional mode for a named parameter, or the legacy regex truncates its name.
   
   Resolve complete source-field names before the legacy alphabet, preserving repeated, reordered and unused field bindings and unknown-name validation. Skip single/double/backtick-quoted text, dollar-quoted literals, comments and `::` casts when detecting generated parameters. Array expressions remain parameter-bearing. Configured `query` takes a separate preparation entry point that preserves its existing positional SQL and field order, including database-specific literal escaping; existing configured named SQL without `?` is retained.
   
   ### Does this PR introduce any user-facing change?
   
   Generated writes can bind these special field names when the target dialect quotes their identifiers correctly. No option, default, dependency, save-mode, transaction, or checkpoint change. EN/ZH JDBC Sink documentation is updated. This is based on dev `b2045b14c`, with no released-version/backport claim.
   
   #12501 is still the separate DuckDB identifier-quoting fix. Here, embedded-double-quote binding is tested with correctly quoted real SQL; the real DuckDB Source → Sink factory flow covers spaces, colons and question marks without importing that pending PR. This is not a universal SQL grammar or a DuckLake upsert/exactly-once change.
   
   ### How was this patch tested?
   
   - Before the fix: 7 errors in 12 actual JDBC preparation tests; ordinary positional SQL, unknown-field checks and the existing parser cases pass.
   - JDK 8 and 17: **611 tests each, zero failures/errors/skips**, independently `clean verify` on connector-jdbc. Includes shared dialect/converter/executor regressions, configured-query routing, real DuckDB prepare/bind/execute and Source → Sink factory → reconnect/read-back. Each JDK is recompiled separately, without excluding tests.
   - Actual isolated MySQL `mysql:8.0`, driver 8.0.27: generated upsert/update/delete and configured backslash-escaped SQL pass on JDK8/17; temporary container removed afterward.
   - Supplemental combined-public-classpath smoke with #12501 also passes actual DuckDB Source → Sink → reconnect for a double-quote column plus space/colon/question-mark columns (2 rows, 5 fields). This requires both pending changes and is not claimed as this PR alone or a release.
   - Existing `JdbcMysqlIT` extended with generated-upsert and configured-literal cases. The full IT runner was **not run locally**: the offline E2E compile lacks starter snapshot artifacts. The independent MySQL smoke above is not presented as the full E2E run.
   - Official MarkdownTest **4/4**, Spotless and `git diff --check` pass.
   
   ```sh
   mvn -pl seatunnel-connectors-v2/connector-jdbc \
     '-Dtest=FieldNamedPreparedStatementTest,*DialectTest,*ConverterTest,*BatchStatementExecutorTest,JdbcSinkFactoryTest,JdbcOutputFormatBuilderTest,DuckDBSourceAndSinkTest,DuckDBCatalogTest' \
     clean verify
   mvn -pl seatunnel-ci-tools -Dtest=MarkdownTest verify
   ```
   
   ### Check list
   
   - [x] Existing test classes and EN/ZH documentation updated.
   - [x] Default behavior and public method signatures preserved; only a preparation entry point added for configured SQL.
   - [x] No new dependency or connector.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Bind JDBC parameters using complete field names [seatunnel]

Posted by "hutiefang76 (via GitHub)" <gi...@apache.org>.
hutiefang76 closed pull request #12518: [Fix][Connector-V2] Bind JDBC parameters using complete field names
URL: https://github.com/apache/seatunnel/pull/12518


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Bind JDBC parameters using complete field names [seatunnel]

Posted by "hutiefang76 (via GitHub)" <gi...@apache.org>.
hutiefang76 commented on PR #12518:
URL: https://github.com/apache/seatunnel/pull/12518#issuecomment-5876548580

   Closing this for now: the new parser also changes existing configured named SQL, and I found a regression with escaped string literals.
   
   `SELECT E'can\'t' AS literal, :id AS id, 'fixed' AS other` prepares and returns `can't / 7 / fixed` with the original parser on DuckDB JDBC 1.3.1.0. With this PR, the literal-skipping regex pairs the escaped quote incorrectly and consumes `:id` as quoted text. The named parameter is left in the SQL, so preparation fails with a parser error at `:`. The custom-SQL entry point reaches the same parser because this query has no `?`.
   
   The positional-SQL compatibility tests did not catch the named-SQL case. The special-field binding fix is still useful, but it needs to preserve existing named queries before this is ready. I will keep the patch locally while sorting out that boundary. Thanks for taking a look.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org