rshdhere commented on code in PR #18935:
URL: https://github.com/apache/iceberg/pull/18935#discussion_r4623526601


##########
api/src/main/java/org/apache/iceberg/Schema.java:
##########
@@ -603,20 +626,33 @@ private List<NestedField> reassignIds(List<NestedField> 
columns, TypeUtil.GetID
     if (getID == null) {
       return columns;
     }
-    Type res =
-        TypeUtil.assignIds(
-            StructType.of(columns),
-            oldId -> {
-              int newId = getID.get(oldId);
-              if (newId != oldId) {
-                idsToReassigned.put(oldId, newId);
-                idsToOriginal.put(newId, oldId);
-              }
-              return newId;
-            });
+
+    TypeUtil.GetID tracked =

Review Comment:
   On breaking when we see a file: I'd keep it working. `PositionDeletesTable` 
goes through this path for every table, so throwing on a file would make 
position_deletes unusable for any table that has a file column.
   
   There's still one gap in the current version, though. The position_deletes 
`GetID` matches by ID value, so any `row.*` column whose ID equals a partition 
field ID (both start at 1000) gets reassigned too. A plain column just gets 
silently re-IDed, but a file column now throws. I reproduced it on 9ed30e4 with 
a wide table whose file column lands on ID 1000, partitioned by `identity(id)` 
(partition field 1000):
   
   ```
   new PositionDeletesTable(table)
   -> UnsupportedOperationException: Cannot reassign file field 1000 to 1007: 
this GetID does not implement get(int, Type)
   ```
   
   The same table with a string column at 1000 loads fine. Partition fields are 
never file-typed, so could the `GetID` in 
`PositionDeletesTable.calculateSchema` override `get(int, Type)` and return 
`oldId` for file types? I'm happy to share the test if it helps.
   



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