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

   # Rationale for this change
   
   In v1 table metadata the partition field ids were not tracked: the spec says 
they were "assigned sequentially in each spec starting at 1,000". A v1 
`partition-spec` (or `partition-specs` entry) whose fields have no `field-id` 
currently fails to parse: a pydantic "Field required" error for one field, and 
`TypeError: '>' not supported between instances of 'NoneType' and 'NoneType'` 
for two or more, raised while computing `last-partition-id`.
   
   `TableMetadataV1.construct_partition_specs` now assigns 1000, 1001, ... 
within each spec when none of its fields has an id, before computing 
`last-partition-id`. A spec that mixes fields with and without ids is rejected 
with Java's message ("Cannot parse spec with missing field IDs"), as in 
`PartitionSpecParser`.
   
   ## Are these changes tested?
   
   Yes, `test_v1_partition_fields_without_field_id` in 
tests/table/test_metadata.py (fails on main, passes here). Also ran 
tests/table, tests/test_serializers.py, tests/catalog/test_base.py and 
tests/catalog/test_sql.py.
   
   ## Are there any user-facing changes?
   
   Old v1 tables written without partition field ids can now be loaded.
   


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