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

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   When `alterTable` adds a column with `autoIncrement = true` on a Doris 
catalog, the request succeeds but the flag is silently dropped. 
`DorisTableOperations.addColumnFieldDefinition` never reads `isAutoIncrement()`.
   
   Emitting `AUTO_INCREMENT` would not fix this. Doris cannot add a working 
auto-increment column:
   
   - Doris 2.1.5+ and 3.0.1+ reject it with `Can not add auto-increment column 
<name>` (apache/doris#37186).
   - On Doris 2.1.0 through 2.1.4 and 3.0.0, the ALTER is accepted and the 
column is recorded as `AUTO_INCREMENT`, but Doris never generates values for 
it. Existing and newly inserted rows get the default or `NULL`. Doris even 
allows a second auto-increment column this way.
   
   Gravitino should reject the change with a clear error, as it already does 
for `UpdateColumnAutoIncrement`.
   
   ### Error message and/or stacktrace
   
   No error. The column is created without auto-increment.
   
   ### How to reproduce
   
   1. Create a Doris table without an auto-increment column.
   2. Call `alterTable` with `TableChange.addColumn(new String[] {"id"}, 
Types.LongType.get(), null, TableChange.ColumnPosition.defaultPos(), false, 
true)`.
   3. The column is added, and `loadTable` reports `autoIncrement = false`.
   
   Result on Doris 2.1.0, running the SQL directly:
   
   ```sql
   ALTER TABLE dup ADD COLUMN id4 BIGINT NOT NULL AUTO_INCREMENT DEFAULT '0';  
-- accepted
   INSERT INTO dup (k, v) VALUES (1, 'a'), (2, 'b');
   SELECT id4 FROM dup;  -- 0, 0
   ```
   
   ### Additional context
   
   Doris docs: auto-increment columns are defined at table creation.
   


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