alamb commented on a change in pull request #9469:
URL: https://github.com/apache/arrow/pull/9469#discussion_r574715077



##########
File path: rust/arrow/src/array/array.rs
##########
@@ -409,4 +578,42 @@ mod tests {
         assert_eq!(a.len(), 0);
         assert_eq!(a.value_offsets()[0], 0i32);
     }
+
+    #[test]
+    fn test_null_boolean() {
+        let array = new_array_with_nulls(&DataType::Boolean, 9);
+        let a = array.as_any().downcast_ref::<BooleanArray>().unwrap();
+        assert_eq!(a.len(), 9);
+        for i in 0..9 {
+            assert!(a.is_null(i));
+        }
+    }
+
+    #[test]
+    fn test_null_primitive() {
+        let array = new_array_with_nulls(&DataType::Int32, 9);
+        let a = array.as_any().downcast_ref::<Int32Array>().unwrap();
+        assert_eq!(a.len(), 9);
+        for i in 0..9 {
+            assert!(a.is_null(i));
+        }
+    }
+
+    #[test]
+    fn test_null_variable_sized() {
+        let array = new_array_with_nulls(&DataType::Utf8, 9);
+        let a = array.as_any().downcast_ref::<StringArray>().unwrap();
+        assert_eq!(a.len(), 9);
+        assert_eq!(a.value_offsets()[9], 0i32);
+    }
+
+    #[test]
+    fn test_null_list_primitive() {
+        let data_type =
+            DataType::List(Box::new(Field::new("item", DataType::Int32, 
true)));

Review comment:
       I vote `panic` for now if you think it is a logic error that a user 
should be avoiding anyways.
   
   Or alternately, we can make it `panic` now and `Result` later if someone 
finds a need




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

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


Reply via email to