Sitelet https://github.com/apache/paimon/issues/10374
Skip to content

[Bug] JSON format reader rounds numeric DECIMAL values through double #10374

Description

@thswlsqls

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version
master @ b0af456

Compute Engine
Engine-agnostic (format). Reached from Flink and Spark JSON format tables.

Minimal reproduce step
Create a JSON format table with a DECIMAL(20,2) column, write a file with an external writer containing the line {"d":12345678901234567.89}, and read it.

JsonFileReader.parseLine() (paimon-format/.../json/JsonFileReader.java line 72) calls readTree on the default mapper, so the number is parsed as a double before it is cast to DECIMAL.

What doesn't meet your expectations?
Expected 12345678901234567.89; actual 12345678901234568.00. A DECIMAL(38,18) value 123456789.123456789 also loses its last digits. fileformat.md maps DECIMAL to a JSON number, so numeric literals are valid input.

Anything else?
Existing round-trip tests miss this because JsonFormatWriter writes DECIMAL as a JSON string, which never takes the double path.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions