use arrow2::{ array::*, datatypes::{DataType, Field}, }; #[test] fn push() { let c1 = Box::new(MutablePrimitiveArray::::new()) as Box; let values = vec![c1]; let data_type = DataType::Struct(vec![Field::new("f1", DataType::Int32, true)]); let mut a = MutableStructArray::new(data_type, values); a.value::>(0) .unwrap() .push(Some(1)); a.push(true); a.value::>(0).unwrap().push(None); a.push(false); a.value::>(0) .unwrap() .push(Some(2)); a.push(true); assert_eq!(a.len(), 3); assert!(a.is_valid(0)); assert!(!a.is_valid(1)); assert!(a.is_valid(2)); assert_eq!( a.value::>(0).unwrap().values(), &Vec::from([1, 0, 2]) ); }