sungwy commented on code in PR #1083: URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1731284834
########## pyiceberg/table/__init__.py: ########## @@ -2492,20 +2492,25 @@ def update_column( except ResolveError as e: raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e + # if other updates for the same field exist in one transaction: if updated := self._updates.get(field.field_id): self._updates[field.field_id] = NestedField( field_id=updated.field_id, name=updated.name, field_type=field_type or updated.field_type, - doc=doc or updated.doc, + doc=doc if doc is not None else updated.doc, + # will raise ValidatorError + # if trying to change an identifier field from required to optional upon commit required=updated.required, ) else: self._updates[field.field_id] = NestedField( field_id=field.field_id, name=field.name, field_type=field_type or field.field_type, - doc=doc or field.doc, + doc=doc if doc is not None else field.doc, + # will raise ValidatorError + # if trying to change an identifier field from required to optional upon commit Review Comment: ```suggestion ``` ########## pyiceberg/table/__init__.py: ########## @@ -2492,20 +2492,25 @@ def update_column( except ResolveError as e: raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e + # if other updates for the same field exist in one transaction: if updated := self._updates.get(field.field_id): self._updates[field.field_id] = NestedField( field_id=updated.field_id, name=updated.name, field_type=field_type or updated.field_type, - doc=doc or updated.doc, + doc=doc if doc is not None else updated.doc, + # will raise ValidatorError + # if trying to change an identifier field from required to optional upon commit Review Comment: ```suggestion ``` -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org