Commit 8fe63dc
authored
fix: add Field alias for SetPartitionStatisticsUpdate (#3035)
<!--
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.
-->1 parent 11af14b commit 8fe63dc
2 files changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1605 | 1605 | | |
1606 | 1606 | | |
1607 | 1607 | | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
1608 | 1612 | | |
1609 | 1613 | | |
1610 | 1614 | | |
| |||
0 commit comments