You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "porkedchop (via GitHub)" <gi...@apache.org> on 2026/10/15 14:09:18 UTC

[PR] fix(table): reuse partition field IDs on v3 tables [iceberg-python]

porkedchop opened a new pull request, #4110:
URL: https://github.com/apache/iceberg-python/pull/4110

   # Rationale for this change
   
   `UpdateSpec._partition_field` only looks for an existing partition field to reuse when the table's format version is exactly 2. On a v3 table, adding back a partition field that was removed earlier gets a new field ID instead of the original one, and removing and re-adding the same field in one `update_spec()` fails with "Cannot add duplicate partition field name". Java's `BaseUpdatePartitionSpec` reuses fields for `formatVersion >= 2`, so this changes the check to match.
   
   ## Are these changes tested?
   
   Yes, added `test_update_spec_reuses_removed_partition_field_id`, run against both the v2 and v3 table fixtures. The v3 case fails without the change.
   
   ## Are there any user-facing changes?
   
   Partition evolution on v3 tables now reuses the original field ID when a removed partition field is added back, the same as v2.
   


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): reuse partition field IDs on v3 tables [iceberg-python]

Posted by "kevinjqliu (via GitHub)" <gi...@apache.org>.
kevinjqliu commented on code in PR #4110:
URL: https://github.com/apache/iceberg-python/pull/4110#discussion_r4368580069


##########
pyiceberg/table/update/spec.py:
##########
@@ -268,7 +268,7 @@ def _add_new_field(
         return PartitionSpec(*partition_fields, spec_id=new_spec_id)
 
     def _partition_field(self, transform_key: tuple[int, Transform[Any, Any]], name: str | None) -> PartitionField:
-        if self._transaction.table_metadata.format_version == 2:
+        if self._transaction.table_metadata.format_version >= 2:

Review Comment:
   looks like we need to follow up and fix a number of these in the code base 



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): reuse partition field IDs on v3 tables [iceberg-python]

Posted by "kevinjqliu (via GitHub)" <gi...@apache.org>.
kevinjqliu merged PR #4110:
URL: https://github.com/apache/iceberg-python/pull/4110


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): reuse partition field IDs on v3 tables [iceberg-python]

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on PR #4110:
URL: https://github.com/apache/iceberg-python/pull/4110#issuecomment-6249911962

   @porkedchop Can you pull in latest main?


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org