Skip to content

fix: add space in decimal type serialization for cross-engine compat#2538

Open
SreeramGarlapati wants to merge 1 commit into
apache:mainfrom
SreeramGarlapati:fix/decimal-type-serialization-spacing
Open

fix: add space in decimal type serialization for cross-engine compat#2538
SreeramGarlapati wants to merge 1 commit into
apache:mainfrom
SreeramGarlapati:fix/decimal-type-serialization-spacing

Conversation

@SreeramGarlapati
Copy link
Copy Markdown
Contributor

Summary

iceberg-rust serializes the decimal type as decimal(P,S) (no space), while the Iceberg spec, Java, and Python all use decimal(P, S) (space after comma). This mismatch can cause issues when metadata written by iceberg-rust is read by strict parsers in other implementations.

What changed

  • serialize_decimal: decimal({precision},{scale})decimal({precision}, {scale})
  • Display for PrimitiveType: same fix for the decimal arm
  • Updated the one test fixture that asserted the old format

Why this is safe

The deserializer already uses .trim() on both precision and scale components, so it accepts both decimal(9,2) and decimal(9, 2). Existing metadata files with the old format continue to be readable.

Closes #2534

Test plan

  • All 1300+ iceberg crate tests pass
  • Workspace compiles cleanly
  • Backwards compat: deserializer handles both formats via trim()

…pliance

The Iceberg spec, Java, and Python all serialize the decimal type as
`decimal(P, S)` (with a space after the comma). iceberg-rust was writing
`decimal(P,S)` which could cause metadata written by Rust to be rejected
or misinterpreted by strict parsers in other implementations.

The deserializer already handles both formats via trim(), so this change
is backwards-compatible for reading.

Closes apache#2534

Co-authored-by: rawataaryan9 <rawataaryan9@users.noreply.github.com>
@SreeramGarlapati SreeramGarlapati force-pushed the fix/decimal-type-serialization-spacing branch from 945b288 to 3499e4b Compare May 30, 2026 04:31
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.

decimal type serialized as decimal(P,S) — diverges from spec/java/python

1 participant