Skip to content

fix(arrow-json): render coerced f32 as its value in the string decoder - #10386

Merged
Jefffrey merged 1 commit into
apache:mainfrom
hareshkh:fix/json-reader-f32-coerce-to-string
Jul 20, 2026
Merged

fix(arrow-json): render coerced f32 as its value in the string decoder#10386
Jefffrey merged 1 commit into
apache:mainfrom
hareshkh:fix/json-reader-f32-coerce-to-string

Conversation

@hareshkh

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

When coercing a float into a string column, StringArrayDecoder ran a f32 through the integer formatter on its raw bits, so it rendered the u32 bit pattern instead of the value (e.g. 1.5f32"1069547520"). The adjacent f64 arm and tape.rs already reconstruct via from_bits.

What changes are included in this PR?

The F32 arm of StringArrayDecoder now uses float_formatter.format_finite(f32::from_bits(n)), matching the f64 arm. Plus a unit test.

Are these changes tested?

Yes — new test_serialize_f32_into_string (fails before the fix, passes after); the full arrow-json suite passes.

Are there any user-facing changes?

Yes (bug fix): an f32 coerced to string now renders its value, not its bit pattern. No API changes. Only reachable via Decoder::serialize with coerce_primitive; JSON text decoding was already correct.

@github-actions github-actions Bot added the arrow Changes to the arrow crate label Jul 20, 2026
@Jefffrey Jefffrey added the bug label Jul 20, 2026
@Jefffrey
Jefffrey merged commit f7f7545 into apache:main Jul 20, 2026
27 checks passed
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks @hareshkh

@hareshkh

Copy link
Copy Markdown
Contributor Author

Thanks for the super quick turn around @Jefffrey !

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

Labels

arrow Changes to the arrow crate bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants