jiangxt2 opened a new issue, #12827:
URL: https://github.com/apache/gravitino/issues/12827

   ### Version
   
   main branch; Doris 3.0.6.2 and 4.0.6
   
   ### Describe what's wrong
   
   The Doris JDBC catalog does not honor the `TableChange.deleteIndex(name, 
ifExists)` contract when the target index is missing. Calling 
`TableChange.deleteIndex("missing_index", true)` on an existing table still 
generates `DROP INDEX` inside the connector's combined `ALTER TABLE` statement, 
so Doris returns an index-not-found error instead of treating the change as a 
no-op.
   
   The expected behavior is that `ifExists=true` succeeds without issuing a 
DROP fragment when the index is absent, while `ifExists=false` continues to 
fail before DDL execution. Deleting an existing index must continue to work 
with either flag.
   
   ### Error message and/or stacktrace
   
   The generated `ALTER TABLE ... DROP INDEX ...` statement is sent to Doris 
and returns an index-not-found error for the missing index. The exact raw 
Doris/JDBC response is not included here.
   
   ### How to reproduce
   
   1. Create an existing table in a Doris JDBC catalog without an index named 
`missing_index`.
   2. Call the table catalog with the following change:
   
   ```java
   tableCatalog.alterTable(
       tableIdentifier,
       TableChange.deleteIndex("missing_index", true));
   ```
   
   3. Observe that the operation fails with an index-not-found error.
   4. Verify the behavior matrix: missing index with `ifExists=true` currently 
fails after DDL submission; missing index with `ifExists=false` fails before 
DDL with the client-side `IllegalArgumentException`; existing index with either 
flag succeeds.
   
   ### Additional context
   
   Doris documents `IF EXISTS` for standalone `DROP INDEX` syntax, while the 
Gravitino Doris connector batches compatible table changes into one `ALTER 
TABLE` statement. The fix should preserve that batching model, omit only the 
missing-index no-op fragment, and avoid swallowing unrelated SQL, 
authorization, connection, or schema-change failures.
   
   As a batch safety constraint for the same combined ALTER path, duplicate 
deletes of the same index and same-name AddIndex/DeleteIndex combinations 
should fail fast in either request order, regardless of the `ifExists` flag. A 
missing-index no-op may be combined only with unrelated supported changes; 
unrelated real changes must remain in the generated ALTER statement.
   
   Relevant Doris documentation: 
https://doris.apache.org/docs/dev/sql-manual/sql-statements/table-and-view/index/DROP-INDEX
   


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