Skip to content

fix: add Field alias for SetPartitionStatisticsUpdate.partition_stati…#3035

Merged
Fokko merged 1 commit intoapache:mainfrom
shiwk:fix_set-partition-statistics_request
Feb 18, 2026
Merged

fix: add Field alias for SetPartitionStatisticsUpdate.partition_stati…#3035
Fokko merged 1 commit intoapache:mainfrom
shiwk:fix_set-partition-statistics_request

Conversation

@shiwk
Copy link
Contributor

@shiwk shiwk commented Feb 11, 2026

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.

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @shiwk, great catch!

@Fokko Fokko merged commit 8fe63dc into apache:main Feb 18, 2026
11 checks passed
kevinjqliu pushed a commit that referenced this pull request Feb 26, 2026
<!--
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.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants