chovy-3012 opened a new pull request, #13183:
URL: https://github.com/apache/seatunnel/pull/13183

   ### Purpose of this pull request
   
   Fixes #13182. `DorisCatalog.truncateTable` executed the TRUNCATE statement 
only when `ignoreIfNotExists == true`, inverting the contract of 
`Catalog#truncateTable`: the truncate must always run on an existing table, and 
the flag must only control the missing-table behavior.
   
   This PR aligns `DorisCatalog` with the `AbstractJdbcCatalog.truncateTable` 
pattern: a `tableExists` pre-check runs first, so an existing table is 
truncated regardless of the flag, and a missing table throws 
`TableNotExistException` when the flag is `false` and is silently skipped when 
it is `true`. The 2-arg overload delegates to the fixed 3-arg method. In-repo 
callers are unaffected: both pass `true` and pre-check table existence 
themselves.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Compared with the released versions and dev, a direct 
`Catalog#truncateTable` call on `DorisCatalog` now behaves as the interface 
documents: an existing table is truncated even when `ignoreIfNotExists=false` 
(previously the truncate was silently skipped — the primary symptom in #13182), 
a missing table with `ignoreIfNotExists=false` fails fast with 
`TableNotExistException` instead of silently doing nothing, and a missing table 
with `ignoreIfNotExists=true` is skipped instead of failing with 
`CatalogException: errCode = 2, detailMessage = Unknown table ...`. Standard 
sink job paths such as `data_save_mode = DROP_DATA` are unchanged.
   
   ### How was this patch tested?
   
   - Added `DorisCatalogTest` (4 unit cases: the full contract matrix above 
plus partition truncation, mocked JDBC connection); run with:
   
     ```bash
     ./mvnw test -pl seatunnel-connectors-v2/connector-doris
     ```
   
     The suite passes 162/162, including the 4 new cases.
   - Added `DorisCatalogIT#testTruncateTable` (Testcontainers starts the Doris 
backend automatically; also covered by the `doris-connector-it` CI leg); run 
with:
   
     ```bash
     ./mvnw -DskipUT -DskipIT=false verify -pl 
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e
     ```
   
   - Before/after verification on a real Doris 2.1.0 cluster: the same 
four-case matrix run against jars built from dev and from this branch (verified 
by javap/md5) moved DorisCatalog contract conformance from 1/4 to 4/4, while 
the `MySqlCatalog` reference stayed 4/4 in both rounds.
   
   ### Check list
   
   * [x] If any new Jar binary package adding in your PR, please add License 
Notice according
     [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
     — n/a, no new jar or dependency.
   * [x] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs
     — n/a, no option or documented behavior changed; the fix restores the 
documented `Catalog#truncateTable` contract.
   * [x] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR.
     — n/a, not an incompatible change.
   * [x] If you are contributing the connector code, please check that the 
following files are updated:
     1. Update 
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
 and add new connector information in it
     2. Update the pom file of 
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in 
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in 
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
     5. Update connector 
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
     — existing connector, so 1/2/3/5 are n/a; e2e test added in 4 
(`DorisCatalogIT#testTruncateTable`).
   


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