You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It looks like the coerce_primitive configuration option on ReaderBuilder is not honored when decoding from serde-compatible objects like serde_json::Value.
To Reproduce
Code to add a test to arrow-json/src/reader/mod.rs that triggers the error
called `Result::unwrap()` on an `Err` value: JsonError("whilst decoding field 'b': expected string got 123")
thread 'reader::tests::test_coercing_primitive_into_string_decoder' panicked at 'called `Result::unwrap()` on an `Err` value: JsonError("whilst decoding field 'b': expected string got 123")', arrow-json/src/reader/mod.rs:2284:37
stack backtrace:
0: rust_begin_unwind
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
1: core::panicking::panic_fmt
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
2: core::result::unwrap_failed
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1651:5
3: core::result::Result<T,E>::unwrap
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/result.rs:1076:23
4: arrow_json::reader::tests::test_coercing_primitive_into_string_decoder
at ./src/reader/mod.rs:2284:21
5: arrow_json::reader::tests::test_coercing_primitive_into_string_decoder::{{closure}}
at ./src/reader/mod.rs:2264:54
6: core::ops::function::FnOnce::call_once
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
7: core::ops::function::FnOnce::call_once
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Expected behavior
I expect the value 123 in column b to be converted to a string.
Additional context
This worked in version 47. I hit the error when updating to DataFusion 33.0.0 with Arrow 48.0.1, but have also confirmed it on main.
My hunch is that this was introduced with #4861, and that some additional logic is needed around here
Describe the bug
It looks like the
coerce_primitive
configuration option onReaderBuilder
is not honored when decoding from serde-compatible objects likeserde_json::Value
.To Reproduce
Code to add a test to arrow-json/src/reader/mod.rs that triggers the error
Expected behavior
I expect the value
123
in columnb
to be converted to a string.Additional context
This worked in version 47. I hit the error when updating to DataFusion 33.0.0 with Arrow 48.0.1, but have also confirmed it on
main
.My hunch is that this was introduced with #4861, and that some additional logic is needed around here
arrow-rs/arrow-json/src/reader/string_array.rs
Lines 45 to 66 in dc75a28
to handle coercing the new TapeElement enumerations (
I64
,I32
,F64
, andF32
).The text was updated successfully, but these errors were encountered: