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

   ## What changes were proposed in this pull request?
   
   ### INDEX Syntax Fix (`DorisTableOperations.java`)
   
   - **PRIMARY_KEY/UNIQUE_KEY filtering**: These are table model keys in Doris, 
not index-level concepts. Filtered from `appendIndexesSql()` and instead 
emitted as `UNIQUE KEY(col)` via new `appendTableModelKeySql()` method
   - **USING clause**: Non-key indexes generate `INDEX `name` (`col`) USING 
<type>` syntax (INVERTED/BITMAP/ANN)
   - **BITMAP → INVERTED fallback**: Doris 4.0.6 removed BITMAP index support; 
always generate `USING INVERTED` for cross-version compatibility
   - **ANN → VECTOR mapping**: Read direction maps Doris ANN index type to 
Gravitino VECTOR; write direction generates `USING ANN`
   - **Backtick quoting**: `addIndexDefinition()` and `deleteIndexDefinition()` 
now quote index names with backticks
   - **Debug guards**: Added `if (LOG.isDebugEnabled())` protection for index 
logging loops
   
   ### Auto Increment Support (`DorisTableOperations.java`)
   
   - Removed local `validateIncrementCol(JdbcColumn[])` override that 
hard-rejected all auto-increment columns
   - Delegated to base class `JdbcTableOperations.validateIncrementCol(columns, 
indexes)` which validates via index metadata
   - Doris-side constraints (UNIQUE_KEYS/DUP_KEYS only, BIGINT type, NOT NULL) 
enforced by Doris server
   
   ## Does this PR introduce any user-facing change?
   
   Users can now create tables with auto-increment columns and secondary 
indexes (INVERTED/ANN) through Gravitino on Doris 3.0+.
   
   ## How was this patch tested?
   
   Unit tests in `TestDorisTableOperationsSqlGeneration`:
   - `testCreateTableWithPrimaryKeyIndex`: PRIMARY_KEY filtered from INDEX 
clause
   - `testCreateTableWithInvertedIndex`: INVERTED index generates `USING 
INVERTED`
   - `testCreateTableWithBitmapIndex`: BITMAP index generates `USING INVERTED` 
(fallback)
   - `testMapDorisIndexType`: ANN→VECTOR, BLOOMFILTER→DATA_SKIPPING_BLOOM_FILTER
   - `testCreateTableWithAutoIncrement`: AUTO_INCREMENT + UNIQUE KEY model
   - `testAddIndexDefinition`: ALTER TABLE ADD INDEX with USING clause
   - `testDeleteIndexDefinition`: DROP INDEX with backtick quoting
   
   Integration tests (Doris 4.0.6 and 3.0.6.2):
   - UNIQUE KEY + AUTO_INCREMENT table creation verified
   - ADD INDEX USING INVERTED verified
   - DROP INDEX verified
   
   Related to #11590, #3272


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