xylaaaaa opened a new pull request, #60169:
URL: https://github.com/apache/doris/pull/60169

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   Currently, Doris does not support `ALTER TABLE ... MODIFY COLUMN` for 
complex type columns (STRUCT/ARRAY/MAP) in Iceberg external tables. This PR 
adds support for safe schema evolution of complex types in Iceberg tables.
   
   **Supported operations:**
   
   | Complex Type | Allowed Operations | Prohibited Operations |
   |--------------|-------------------|----------------------|
   | STRUCT | Append new fields, safe type promotion for existing fields | 
Field rename/delete |
   | ARRAY | Element type safe promotion | Incompatible element type change |
   | MAP | Value type safe promotion | Key type change |
   
   **Safe type promotions supported in nested types:**
   - `INT` → `BIGINT`, `LARGEINT`
   - `TINYINT` → `SMALLINT`, `INT`, `BIGINT`, `LARGEINT`
   - `SMALLINT` → `INT`, `BIGINT`, `LARGEINT`
   - `BIGINT` → `LARGEINT`
   - `FLOAT` → `DOUBLE`
   - `VARCHAR(n)` → `VARCHAR(m)` where m > n
   
   **Constraints:**
   - All new nested fields must be nullable
   - Cannot change optional to required
   - Complex type default values only support NULL
   
   ### Release note
   
   Support ALTER TABLE MODIFY COLUMN for complex types (STRUCT/ARRAY/MAP) in 
Iceberg external tables, including appending struct fields and safe type 
promotions.
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [x] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   **Manual test steps:**
   ```sql
   -- Create Iceberg table with complex types
   CREATE TABLE iceberg_catalog.test_db.iceberg_tbl (
     id BIGINT,
     user_info STRUCT<name:STRING, scores:ARRAY<INT>, age:INT>,
     dt STRING
   );
   
   -- Test 1: STRUCT append field (should succeed)
   ALTER TABLE iceberg_catalog.test_db.iceberg_tbl 
   MODIFY COLUMN user_info STRUCT<name:STRING, scores:ARRAY<INT>, age:INT, 
email:STRING>;
   
   -- Test 2: STRUCT nested ARRAY element type promotion (should succeed)
   ALTER TABLE iceberg_catalog.test_db.iceberg_tbl 
   MODIFY COLUMN user_info STRUCT<name:STRING, scores:ARRAY<BIGINT>, age:INT, 
email:STRING>;
   
   -- Test 3: STRUCT field rename (should fail)
   ALTER TABLE iceberg_catalog.test_db.iceberg_tbl 
   MODIFY COLUMN user_info STRUCT<full_name:STRING, scores:ARRAY<BIGINT>, 
age:INT, email:STRING>;
   -- Expected error: Cannot rename struct field from 'name' to 'full_name'
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to