Fokko commented on code in PR #245: URL: https://github.com/apache/iceberg-python/pull/245#discussion_r1466152450
########## pyiceberg/table/__init__.py: ########## @@ -533,6 +543,39 @@ def _(update: SetCurrentSchemaUpdate, base_metadata: TableMetadata, context: _Ta return base_metadata.model_copy(update={"current_schema_id": new_schema_id}) +@_apply_table_update.register(AddPartitionSpecUpdate) +def _(update: AddPartitionSpecUpdate, base_metadata: TableMetadata, context: _TableMetadataUpdateContext) -> TableMetadata: + for spec in base_metadata.partition_specs: + if spec.spec_id == update.spec_id: + raise ValueError(f"Cannot add partition spec with id {spec.spec_id}, it already exists") Review Comment: Nit: ```suggestion raise ValueError(f"Partition spec with id {spec.spec_id} already exists: {spec}") ``` -- 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