Skip to content

fix(spec): default PartitionStatistics totalBuckets when absent - #986

Open
jackylee-ch wants to merge 1 commit into
apache:mainfrom
jackylee-ch:fix/partition-statistics-default-total-buckets
Open

jackylee-ch wants to merge 1 commit into
apache:mainfrom
jackylee-ch:fix/partition-statistics-default-total-buckets

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

PartitionStatistics::total_buckets had no serde default, so deserializing statistics that omit totalBuckets — e.g. produced by an older Paimon version that predates the field, which a REST catalog may still return during a mixed-version deployment — failed with a missing-field error instead of reading the record.

Java declares the field as @JsonProperty on a primitive int and documents that it "defaults to 0 if absent (older Paimon version)". Add #[serde(default)] so the Rust struct falls back to 0 the same way.

A test deserializes a payload without totalBuckets and asserts it reads as 0; it fails with a missing-field error before the change.

`PartitionStatistics::total_buckets` had no serde default, so deserializing
statistics that omit `totalBuckets` — e.g. produced by an older Paimon version
that predates the field, which a REST catalog may still return — failed with a
missing-field error instead of reading the rest of the record. Java treats the
field as `@JsonProperty` on a primitive `int` and documents that it "defaults
to 0 if absent (older Paimon version)".

Add `#[serde(default)]` so the field falls back to 0, matching Java.
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.

1 participant