Yibo-Dong opened a new issue, #19285:
URL: https://github.com/apache/iceberg/issues/19285

   ### Apache Iceberg version
   
   main (development)
   
   ### Query engine
   
   Spark
   
   ### Please describe the bug 🐞
   
   With a nested identifier field `s.id`, renaming `s` or `s.id` fails, and the 
schema is not changed. If the new leaf name equals a top-level column, the 
rename succeeds but the identifier silently moves to that top-level column. 
Renaming a top-level identifier field works. Reproduced on `main` (3bfa3e4, 
2026-12-01) and 1.12.0, Spark 3.5.5.
   
   ### Reproduction
   
   ```sql
   -- (1) rename the parent struct, or the nested identifier field itself
   CREATE TABLE local.db.t (s STRUCT<id: INT NOT NULL> NOT NULL, v STRING) 
USING iceberg;
   ALTER TABLE local.db.t SET IDENTIFIER FIELDS s.id;
   ALTER TABLE local.db.t RENAME COLUMN s TO r;
   ALTER TABLE local.db.t RENAME COLUMN s.id TO id2;
   
   -- (2) the new leaf name equals a top-level column
   CREATE TABLE local.db.w (s STRUCT<id: INT NOT NULL> NOT NULL, x INT NOT 
NULL) USING iceberg;
   ALTER TABLE local.db.w SET IDENTIFIER FIELDS s.id;
   ALTER TABLE local.db.w RENAME COLUMN s.id TO x;
   SHOW TBLPROPERTIES local.db.w ('identifier-fields');
   
   -- control: a top-level identifier field
   CREATE TABLE local.db.c (id INT NOT NULL, v STRING) USING iceberg;
   ALTER TABLE local.db.c SET IDENTIFIER FIELDS id;
   ALTER TABLE local.db.c RENAME COLUMN id TO id2;
   SHOW TBLPROPERTIES local.db.c ('identifier-fields');
   ```
   
   ### Expected
   
   | Query | Result |
   |---|---|
   | (1) `RENAME COLUMN s TO r` | succeeds, identifier is `r.id` |
   | (1) `RENAME COLUMN s.id TO id2` | succeeds, identifier is `s.id2` |
   | (2) `identifier-fields` of `w` | `[s.x]` |
   | control `identifier-fields` of `c` | `[id2]` |
   
   ### Actual
   
   | Query | Result |
   |---|---|
   | (1) `RENAME COLUMN s TO r` | `Cannot add field s.id as an identifier 
field: not found in current schema or added columns` |
   | (1) `RENAME COLUMN s.id TO id2` | `Cannot add field id2 as an identifier 
field: not found in current schema or added columns` |
   | (2) `identifier-fields` of `w` | `[x]` (the top-level column `x`, a 
different field) |
   | control `identifier-fields` of `c` | `[id2]` |
   
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [x] I cannot contribute a fix for this bug at this time


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