tustvold commented on code in PR #7015:
URL: https://github.com/apache/arrow-rs/pull/7015#discussion_r2002134825
##########
arrow-json/src/writer/mod.rs:
##########
@@ -351,8 +360,18 @@ where
}
let array = StructArray::from(batch.clone());
- let mut encoder = make_encoder(&array, &self.options)?;
+ let field = Arc::new(Field::new_struct(
+ "",
+ batch.schema().fields().iter().cloned().collect::<Vec<_>>(),
+ false,
+ ));
+
+ let encoder = make_encoder(&field, &array, &self.options)?;
+
+ // Validate that the root is not nullable
+ assert!(!encoder.has_nulls(), "root cannot be nullable");
+ let mut encoder = make_encoder(&field, &array, &self.options)?;
Review Comment:
```suggestion
let mut encoder = make_encoder(&field, &array, &self.options)?;
// Validate that the root is not nullable
assert!(!encoder.has_nulls(), "root cannot be nullable");
```
Or am I missing something subtle?
--
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]