unikdahal commented on code in PR #5414:
URL: https://github.com/apache/datafusion-comet/pull/5414#discussion_r3836435855
##########
native/spark-expr/src/json_funcs/from_json.rs:
##########
@@ -393,7 +397,14 @@ fn finish_builder(builder: FieldBuilder) ->
Result<ArrayRef> {
.map(finish_builder)
.collect::<Result<Vec<_>>>()?;
let null_buf = arrow::buffer::NullBuffer::from(null_buffer);
- Arc::new(StructArray::new(fields, nested_arrays, Some(null_buf)))
+ // `StructArray::new` derives its row count from the first child
array; a zero-field
+ // schema (e.g. a `struct<>`-typed field nested inside a larger
schema) has no child
+ // arrays to derive it from, so the count is supplied explicitly
here instead.
+ if fields.is_empty() {
+ Arc::new(StructArray::new_empty_fields(null_buf.len(),
Some(null_buf)))
Review Comment:
Apologies, missed running `cargo fmt` before pushing. Fixed. You can trigger
the CI run now @sunchao
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]