amitvijapur commented on code in PR #11181:
URL: https://github.com/apache/arrow-rs/pull/11181#discussion_r4281805451


##########
arrow-json/src/reader/mod.rs:
##########
@@ -4381,4 +4381,68 @@ mod tests {
         let err = read(false);
         assert!(err.contains("returned 0 values for 1 rows"), "{err}");
     }
+
+    #[test]
+    fn test_scalar_promoted_to_list() {
+        let buf = r#"{"a": 1}

Review Comment:
   @alamb @Jefffrey, the source comparison supports treating scalar-to-list 
promotion as a policy choice rather than assuming it should be the default:
   
   - At the checked commit, Arrow C++ rejects numeric scalars for list fields 
and established scalar/array kind changes. Its [array 
parser](https://github.com/apache/arrow/blob/9b34c4a6a8856212b885f6a1e934795af04f3192/cpp/src/arrow/json/parser.cc#L902)
 requires an array builder, and [scalar 
appends](https://github.com/apache/arrow/blob/9b34c4a6a8856212b885f6a1e934795af04f3192/cpp/src/arrow/json/parser.cc#L998)
 reject mismatched builder kinds. This does not rule out promotion from a null 
builder during inference.
   - Jackson 2.14 offers 
[ACCEPT_SINGLE_VALUE_AS_ARRAY](https://fasterxml.github.io/jackson-databind/javadoc/2.14/com/fasterxml/jackson/databind/DeserializationFeature.html#ACCEPT_SINGLE_VALUE_AS_ARRAY),
 disabled by default. That wraps single values when deserializing into 
array/collection targets, not during schema inference.
   
   My patch makes the reader accept the schema inference already produces, but 
that does not establish that promotion is the right default. I can rework the 
inference side instead once we agree on the intended behavior and compatibility 
requirements.
   
   Codex assisted this source/documentation comparison and drafted this reply. 
No local runtime comparisons were performed.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to