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

   ### Purpose of this pull request
   
   Fixes #12515. `RECREATE_SCHEMA`, `DROP_DATA`, and `ERROR_WHEN_DATA_EXISTS` 
currently fail before writing because DuckDBCatalog inherits unsupported 
drop/truncate/data-existence SQL hooks. This implements those hooks through the 
existing SaveModeHandler lifecycle. Each identifier component is escaped, and 
explicit attached catalog names are retained to protect same-named local tables.
   
   ### Does this PR introduce any user-facing change?
   
   Yes. Recreate replaces the target schema, drop-data clears rows while 
preserving the table, and the data-existence mode accepts an empty target but 
rejects a populated one without altering its rows. Default append, options, 
transactions, and checkpoint semantics remain unchanged. EN/ZH Sink docs 
explain these modes.
   
   This is based on current dev `b2045b14c`; no released-version/backport 
claim. Full attached-catalog metadata and CREATE TABLE routing is separately 
handled in #12506. When #12501/#12503/#12506 land, I will reconcile the quoting 
helper on rebase rather than copy their changes here. The DuckLake case below 
does not claim complete automatic Lake recreate support.
   
   ### How was this patch tested?
   
   - Original Source/Sink factory fixture: three errors in five tests, from the 
three unsupported hooks; append and the existing flow pass.
   - JDK 8 and 17: 38 tests each, zero failures/errors/skips, with 
connector-jdbc `verify`. Covers real JdbcSinkFactory → SaveModeHandler → writer 
→ reconnect, append controls, schema replacement, empty/populated targets, 
quoted identifiers, missing-object flags, and same-named local/attached 
targets. Existing Catalog drop/truncate tests now call the public API rather 
than hand-written SQL.
   - Actual DuckLake extension smoke on JDBC 1.3.1.0: clear/reject through 
JdbcSaveModeHandler, public Catalog drop, lake data retained after rejection, 
and local table untouched. Uses SQLite metadata/local data and runs only when 
both extension properties are supplied; default CI skips this one extension 
case.
   - Spotless, `git diff --check`, and the official MarkdownTest (4/4) pass. No 
DuckDB E2E class exists, so the current real JDBC flow test is extended.
   
   ```sh
   mvn -pl seatunnel-connectors-v2/connector-jdbc \
     
-Dtest=DuckDBCatalogTest,DuckDBSourceAndSinkTest,DuckDBDialectTest,JdbcSinkFactoryTest
 \
     -Dducklake.extension=/path/to/v1.3.1/ducklake.duckdb_extension \
     -Dsqlite.scanner.extension=/path/to/v1.3.1/sqlite_scanner.duckdb_extension 
verify
   mvn -pl seatunnel-ci-tools -Dtest=MarkdownTest verify
   ```
   
   ### Check list
   
   - [x] Tests and EN/ZH documentation updated.
   - [x] No new connector, dependency, binary, option, or default introduced; 
plugin mappings/distribution are unchanged.
   - [x] No incompatible default behavior change.
   


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