Skip to content

Decimal Should Reject precision > 38 #3583

Description

@sungwy

Apache Iceberg version

No response

Please describe the bug 🐞

The spec requires decimal precision to be 38 or less ("Scale is fixed, precision must be 38 or less"). Parsing the schema type string decimal(39, 0) (or any P > 38) should be rejected, but it is accepted: decimal(39, 0) creates DecimalType(precision=39, scale=0) with no error.

The Java reference implementation rejects it: DecimalType.of(39, 0) raises IllegalArgumentException: Decimals with precision larger than 38 are not supported: 39 (api/.../types/Types.java).

Precision above 38 isn't representable in decimal's fixed-byte storage, so silently accepting it can corrupt downstream encoding.

Expected: reject decimal(P, S) with P > 38 at parse/construction time.

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions