Skip to content

fix(arrow/csv): preserve decimal precision#1022

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/csv-decimal-formatting
Open

fix(arrow/csv): preserve decimal precision#1022
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/csv-decimal-formatting

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Rationale for this change

The CSV writer converts decimal values through math.Pow10 and big.Float. That changes valid Decimal128 and Decimal256 values for many scales and drops significant trailing zeros from fixed-scale output.

What changes are included in this PR?

  • Format Decimal128 and Decimal256 values directly with their exact ToString implementations.
  • Preserve the declared scale, including trailing zeros and negative scales.
  • Update existing zero-value expectations to retain their two decimal places.

Are these changes tested?

Yes. The regression test covers a high-precision Decimal128 with a positive scale and a Decimal256 with a negative scale. All CSV tests and the assertion build pass with the required Parquet test data.

@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 25, 2026 20:43
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