YiYao223 commented on code in PR #11861:
URL: https://github.com/apache/arrow-rs/pull/11861#discussion_r4365945137


##########
arrow-array/src/record_batch.rs:
##########
@@ -1668,6 +1668,79 @@ mod tests {
             "Invalid argument error: Column 'a' is declared as non-nullable 
but contains null values",
             format!("{}", maybe_batch.err().unwrap())
         );
+
+        // Sparse UnionArray with logical null in child
+        let fields =
+            arrow_schema::UnionFields::try_new([0], [Field::new("u", 
DataType::Int32, true)])
+                .unwrap();
+        let child = Arc::new(Int32Array::from(vec![Some(1), None])) as 
ArrayRef;
+        let union_array = Arc::new(
+            crate::UnionArray::try_new(fields, vec![0, 0].into(), None, 
vec![child]).unwrap(),
+        );
+        let schema = Arc::new(Schema::new(vec![Field::new(
+            "a",
+            union_array.data_type().clone(),
+            false,
+        )]));
+        let maybe_batch = RecordBatch::try_new(schema, vec![union_array]);
+        assert_eq!(
+            "Invalid argument error: Column 'a' is declared as non-nullable 
but contains null values",
+            format!("{}", maybe_batch.err().unwrap())
+        );
+
+        // RunArray whose value is null
+        let values = Int32Array::from(vec![None]);

Review Comment:
   Done! Split each case into its own dedicated test (  
est_validate_logical_nulls_union,       est_validate_logical_nulls_run_array, 
and       est_validate_logical_nulls_dictionary).



-- 
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