shiwk opened a new pull request, #3035:
URL: https://github.com/apache/iceberg-python/pull/3035
…stics
<!--
Thanks for opening a pull request!
-->
<!-- In the case this PR will resolve an issue, please replace
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
<!-- Closes #${GITHUB_ISSUE_ID} -->
# Rationale for this change
Add `Field(alias="partition-statistics")` to
`SetPartitionStatisticsUpdate.partition_statistics` to ensure correct
serialization/deserialization with the hyphenated key format.
## Problem
The `partition_statistics` field was missing an explicit `Field` alias,
which means:
- When serializing with `model_dump(by_alias=True)`, it would use the Python
attribute name `partition_statistics` (with underscore) instead of the Iceberg
specification format `partition-statistics` (with hyphen)
- This causes incompatibility with the Iceberg table metadata format
specification
## Solution
Added `Field(alias="partition-statistics")` to ensure:
- Proper serialization to JSON/dict using hyphenated key names that comply
with Iceberg spec
- Correct deserialization when parsing external metadata with hyphenated keys
- Consistency with other similar fields in the codebase (e.g.,
`snapshot_ids` with alias `snapshot-ids`)
## Are these changes tested?
Yes. Added verification in `test_set_partition_statistics_update()` to
validate that:
1. The update object serializes to JSON with the correct
`"partition-statistics"` key
2. The key is present in the serialized output
## Are there any user-facing changes?
No. This is an internal fix to ensure metadata serialization format
compliance. The change is transparent to users and improves interoperability
with the Iceberg specification.
<!-- In the case of user-facing changes, please add the changelog label. -->
--
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]