chovy-3012 opened a new issue, #13182:
URL: https://github.com/apache/seatunnel/issues/13182

   
   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   ---
   
   ### What happened
   
   The truncate-table operation in the Doris catalog takes an 
`ignore-if-not-exists` option that should only control the missing-table case: 
table missing → fail or skip depending on the option; table exists → data 
always cleared. In the Doris catalog the option instead gates the execution 
itself — the truncate only runs when the option is enabled, so both directions 
are inverted.
   
   **Environment & data**
   
   - Doris 2.1.0, official all-in-one Docker image — FE http `127.0.0.1:8030`, 
query port `127.0.0.1:9030`, user `root` with empty password
   - SeaTunnel 3.1.0 (current dev), Java 11, Zeta local mode
   - Target table `test_db.orders`, pre-seeded with the previous run's 3 rows:
   
   | id | name |
   | --- | --- |
   | 9001 | old-1 |
   | 9002 | old-2 |
   | 9003 | old-3 |
   
   **How to reproduce**
   
   1. Built-in job path: run the job config below — a nightly rebuild writing 5 
fresh rows with `data_save_mode = "DROP_DATA"`.
   2. Direct invocation: call the same truncate-table operation through the 
Doris catalog with each table/option combination of the summary table (e.g. on 
the seeded table above with the option disabled).
   
   **Summary of observed behavior** (verified against the real Doris 2.1.0 
backend; row 1 = step 1, rows 2–5 = step 2):
   
   | # | Table state | ignore-if-not-exists | Expected | Actual |
   | --- | --- | --- | --- | --- |
   | 1 | exists | enabled (built-in path fixes it internally) | old rows 
cleared before the write | works — job green, only the 5 new rows remain |
   | 2 | exists | disabled | data cleared | nothing happens — no error, 3 old 
rows stay; a following write lands on top (8 rows) |
   | 3 | exists | enabled | data cleared | works |
   | 4 | missing | disabled | error stating the table does not exist | nothing 
happens — no error |
   | 5 | missing | enabled | skipped silently | fails with unknown-table error |
   
   Row 2 is the worst case: silent data retention, no error anywhere. As a 
control, the same four direct combinations against the MySQL catalog behave 
exactly as expected, so the deviation is specific to the Doris catalog.
   
   ---
   
   ### SeaTunnel Version
   
   3.1.0 (current dev)
   
   Also present in the 3.0.0 release (same behavior verified on the release 
tag).
   
   Doris backend: 2.1.0.
   
   ---
   
   ### SeaTunnel Config
   
   Job config for reproduction step 1:
   
   ```hocon
   env {
     parallelism = 1
     job.mode = "BATCH"
   }
   
   source {
     FakeSource {
       plugin_output = "fake"
       row.num = 5
       schema = {
         fields {
           id = "int"
           name = "string"
         }
       }
     }
   }
   
   sink {
     Doris {
       fenodes = "127.0.0.1:8030"
       username = "root"
       password = ""
       database = "test_db"
       table = "orders"
       sink.label-prefix = "nightly_refresh"
       data_save_mode = "DROP_DATA"
       schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"
       doris.config = {
         format = "json"
         read_json_by_line = "true"
       }
     }
   }
   ```
   
   No job-level option disables ignore-if-not-exists for the Doris catalog, so 
rows 2–5 are only reachable by direct catalog invocation (step 2).
   
   ---
   
   ### Running Command
   
   ```shell
   sh bin/seatunnel.sh --config config/nightly-refresh.conf -e local
   ```
   
   Observed: the job finishes successfully; `test_db.orders` has 5 rows, ids 
9001–9003 gone (row 1).
   
   ---
   
   ### Error Exception
   
   Row 2 produces no error at all — the call returns normally and the data is 
silently kept. That is the bug.
   
   Row 5, the call that was told to skip missing tables, fails instead:
   
   ```log
   org.apache.seatunnel.api.table.catalog.exception.CatalogException: Failed 
TRUNCATE TABLE in catalog test_db.missing_table
   Caused by: java.sql.SQLSyntaxErrorException: errCode = 2, detailMessage = 
Unknown table 'missing_table'
   ```
   
   ---
   
   ### Zeta or Flink or Spark Version
   
   Zeta, local mode (job-level scenario); rows 2–5 are engine-independent 
catalog-level behavior.
   
   ---
   
   ### Java or Scala Version
   
   Java 11
   
   ---
   
   ### Screenshots
   
   N/A
   
   ---
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ---
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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