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

   Closes #4362
   
   # Rationale for this change
   
   When a partition field is renamed (via `update_spec().rename_field()` or via 
v1 auto-renaming voided fields on re-add), `specs_struct()` adopts the latest 
field name per `field_id`. Previously, `inspect.py` constructed partition 
dictionaries using each entry's historical spec field names directly 
(`field.name`), causing PyArrow conversion to silently drop pre-rename 
partition values as `None` (or misattribute them to newly added fields sharing 
the old name).
   
   This PR:
   1. Updates `InspectTable.entries()`, `partitions()`, and 
`_get_files_from_manifest()` to map partition values by `field.field_id` 
through `specs_struct()`, preserving historical partition values in the PyArrow 
output.
   2. Keys `partitions_map` in `partitions()` by `(file.spec_id, 
partition_record_dict)` so partition counts and statistics are tracked per 
specification layout.
   
   ## Are these changes tested?
   
   Yes:
   - Added `test_inspect_partitions_and_files_after_rename_field` in 
`tests/table/test_inspect.py` testing `partitions()`, `files()`, 
`data_files()`, `all_files()`, `all_data_files()`, and `entries()`.
   - Added `test_inspect_files_after_v1_partition_field_readd` in 
`tests/table/test_inspect.py` testing field attribution across voided and 
re-added partition fields in format v1 tables.
   
   ## Are there any user-facing changes?
   
   Bugfix: `table.inspect` tables accurately report historical partition values 
after partition field renames and partition re-additions.


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