ShivamSharma43 commented on code in PR #2523:
URL: https://github.com/apache/iceberg-go/pull/2523#discussion_r4542451350
##########
table/update_schema.go:
##########
@@ -1135,7 +1135,7 @@ func (u *UpdateSchema) Apply() (*iceberg.Schema, error) {
field, ok =
newSchema.FindFieldByNameCaseInsensitive(name)
}
if !ok {
- return nil, fmt.Errorf("identifier field not found:
%s", name)
+ return nil, fmt.Errorf("identifier field not found: %s
(to delete an identifier field, also update the identifier fields with
SetIdentifierField)", name)
Review Comment:
Done in a991bb1. `Apply` now checks each identifier name against the
original schema (honouring `caseSensitive`) and rejects it if that field is in
`deletes`. I also added the parent walk from the same Java block, so deleting a
struct that contains an identifier field fails with `cannot delete field key as
it will delete nested identifier field key.id` instead of "not found". The "not
found" message is back to its original wording.
`TestDeleteIdentifierColumn` now also covers delete-then-add-same-name, a
case-insensitive delete, and deleting the parent struct.
`TestSetIdentifierField/test_delete_then_set_identifier_to_deleted_name_fails`
now expects the new error, since that case is also a deleted identifier in the
original schema.
--
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]