bharos opened a new pull request, #15841:
URL: https://github.com/apache/iceberg/pull/15841

   ## What
   
   Previously `SchemaUpdate.ApplyChanges` silently produced an empty struct 
type,
   which is undefined behavior. This change rejects it with an 
`IllegalArgumentException`.
   
   This is consistent with the existing guards in the same class that already 
reject
   deleting element types from lists (`"Cannot delete element type from list"`) 
and
   value types from maps (`"Cannot delete value type from map"`). Structs were 
the
   only container type missing this validation.
   
   ## How
   
   Added a `Preconditions.checkArgument` in `ApplyChanges.field()` that checks 
whether
   the final field result is a struct with no fields. The check runs **after** 
additions
   are applied, so the "delete-all-then-add" pattern (e.g. deleting a field then
   re-adding it under a different ID) still works correctly.
   
   Deleting the struct column itself is unaffected — that returns `null` early 
via the
   `deletes` check before our validation is ever reached.
   
   ## Testing
   
   Added three tests covering the three contexts where nested structs appear:
   - `testDeleteAllFieldsFromNestedStruct` — direct struct column 
(`preferences`)
   - `testDeleteAllFieldsFromMapValueStruct` — map value struct (`locations`)
   - `testDeleteAllFieldsFromListElementStruct` — list element struct (`points`)
   
   All 102 existing `TestSchemaUpdate` tests pass.


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