phillipleblanc commented on code in PR #7436: URL: https://github.com/apache/arrow-rs/pull/7436#discussion_r2080689877
########## arrow-array/src/array/struct_array.rs: ########## @@ -842,4 +844,23 @@ mod tests { ); assert_eq!(format!("{arr:?}"), "StructArray\n-- validity:\n[\n valid,\n null,\n valid,\n null,\n valid,\n null,\n valid,\n null,\n valid,\n null,\n ...10 elements...,\n valid,\n null,\n valid,\n null,\n valid,\n null,\n valid,\n null,\n valid,\n null,\n]\n[\n-- child 0: \"c\" (Int32)\nPrimitiveArray<Int32>\n[\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n ...10 elements...,\n 20,\n 21,\n 22,\n 23,\n 24,\n 25,\n 26,\n 27,\n 28,\n 29,\n]\n]") } + + #[test] + fn test_struct_array_logical_nulls() { + // Field is non-nullable + let field = Field::new("a", DataType::Int32, false); + let values = vec![1, 2, 3]; + // Create a NullBuffer with all bits set to valid (true) + let nulls = NullBuffer::from(vec![true, true, true]); + let array = Int32Array::new(values.into(), Some(nulls)); + let child = Arc::new(array) as ArrayRef; + assert!(child.logical_nulls().is_some()); + assert_eq!(child.logical_nulls().unwrap().null_count(), 0); + + let fields = Fields::from(vec![field]); + let arrays = vec![child]; + let nulls = None; + + drop(StructArray::try_new(fields, arrays, nulls).expect("should not error")); Review Comment: It was my linter complaining about an unused value, `let _ = ` was the alternative. But I may have stricter lint setting than this repo, so I'll change it. -- 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