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

   ### Describe the feature
   
   The Doris catalog does not support `RenameColumn` table change. When a user 
attempts to rename a column via `alterTable`, Gravitino throws an error 
indicating the operation is not yet supported.
   
   MySQL, PostgreSQL, and StarRocks catalogs all implement this operation. The 
StarRocks catalog is the closest reference since StarRocks shares the same code 
lineage as Doris.
   
   ### Motivation
   
   Column rename is a common table evolution operation. Doris supports `ALTER 
TABLE t RENAME COLUMN old_name new_name` natively (from version 2.0+ with 
`light_schema_change` enabled). The Gravitino Doris catalog does not yet 
implement it, while other JDBC catalogs already support it. This gap means 
users managing Doris tables through Gravitino must bypass the unified API to 
perform a common schema evolution task.
   
   ### Describe the solution
   
   Follow the pattern used by the StarRocks catalog:
   
   1. Validate the old column exists in the table.
   2. Validate the new column name doesn't conflict with an existing column.
   3. Generate the appropriate `RENAME COLUMN` DDL for the target Doris version.
   
   For Doris versions prior to 2.0 (where `light_schema_change` is not 
available and RENAME COLUMN is not supported), the operation should fail with a 
clear error message rather than forwarding a raw server-side error.
   
   ### Test plan
   
   | # | Scenario | Expected after fix |
   |---|----------|-------------------|
   | 1 | Rename a single column via Gravitino alterTable | column renamed, 
loadTable confirms new name |
   | 2 | Rename to an existing column name | clear error, table unchanged |
   | 3 | Rename a non-existent column | clear error, table unchanged |
   | 4 | Rename a column that has an INDEX defined on it | column renamed, 
INDEX reference auto-updated |
   | 5 | Multiple consecutive renames on same table | all renames succeed |
   | 6 | Doris version without `light_schema_change` support | graceful error 
(e.g., `UnsupportedOperationException`) |
   
   ### Additional context
   
   **Test results** (Docker, before fix):
   
   | # | Scenario | Gravitino | Native Doris |
   |---|----------|:---------:|:------------:|
   | 1 | alterTable RenameColumn on 4.0.6 | ❌ `IllegalArgumentException` | ✅ 
`RENAME COLUMN old new` |
   | 2 | alterTable RenameColumn on 3.0.6.2 | ❌ same error | ✅ works |
   | 3 | alterTable RenameColumn on 1.2.2 | ❌ same error | ❌ 
`light_schema_change` required |
   | 4 | Rename to existing column name (native) | — | ❌ `Column name[value] is 
already used` |
   | 5 | Rename non-existent column (native) | — | ❌ `Column[nonexist] does not 
exists` |
   | 6 | Rename indexed column (native) | — | ✅ INDEX updated automatically |
   
   Gravitino currently fails uniformly across all versions — the native Doris 
behavior varies, so version detection is needed.
   
   I'd like to pick this up. Please let me know if you have any feedback.
   


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