jiangxt2 opened a new pull request, #12737:
URL: https://github.com/apache/gravitino/pull/12737

   ### What changes were proposed in this pull request?
   
   This pull request adds a Doris-specific field-shape validator shared by 
CREATE TABLE index generation and ALTER TABLE ADD INDEX. The validator requires 
exactly one non-blank top-level field and returns that validated field for SQL 
generation.
   
   It also adds focused tests for valid index SQL, malformed field shapes, 
consistent CREATE and ALTER validation, the no-JDBC-statement failure path, and 
the real Doris 4.x ADD/DROP INDEX lifecycle.
   
   ### Why are the changes needed?
   
   The Doris ALTER ADD INDEX path currently reads only `getFieldNames()[0][0]`. 
When a request contains multiple fields or a nested field path, Gravitino 
silently discards the remaining components and can create a valid single-column 
Doris index that does not match the request.
   
   Rejecting unsupported field shapes before DDL generation prevents this 
semantic truncation and makes CREATE and ALTER enforce the same Doris connector 
contract. Valid single-field index SQL and existing key-model behavior remain 
unchanged.
   
   Fix: #12736
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Doris CREATE TABLE and ALTER TABLE ADD INDEX requests containing 
multiple fields, nested field paths, empty field shapes, or blank field names 
now fail with an explicit `IllegalArgumentException` instead of being truncated 
or producing invalid SQL. Valid single-field index operations are unchanged, 
and no public API or property key is added or removed.
   
   ### How was this patch tested?
   
   - `./gradlew :catalogs:catalog-jdbc-doris:spotlessCheck`
   - `./gradlew rat`
   - `./gradlew :catalogs:catalog-jdbc-doris:test -PskipITs`
   - `./gradlew :catalogs:catalog-jdbc-doris:test --tests 
'org.apache.gravitino.catalog.doris.integration.test.CatalogDoris4xIT.testAddAndDropInvertedIndex'
 -PskipDockerTests=false -PdorisMultiVersionTest`
   - `./gradlew :catalogs:catalog-jdbc-doris:build -x test`
   


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