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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to