adriangb commented on code in PR #7015:
URL: https://github.com/apache/arrow-rs/pull/7015#discussion_r2002136062


##########
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:
   Good catch 😄 



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to