bjchambers commented on issue #734:
URL: https://github.com/apache/arrow-rs/issues/734#issuecomment-910492451
```
#[test]
fn test_null_struct() {
let struct_type =
DataType::Struct(vec![Field::new("data", DataType::Int64,
true)]);
let array = new_null_array(&struct_type, 9);
let a = array.as_any().downcast_ref::<StructArray>().unwrap();
assert_eq!(a.len(), 9);
for i in 0..9 {
assert!(a.is_null(i));
}
// assert_eq!(a.column(0).len(), 9); // fails (length is 0)
// a.slice(0, 5); // panics (because the field arrays are empty)
}
```
I see two ways of fixing this:
1. I'm guessing the right way is to have the `new_null_array` create null
columns of the given length for each of the fields.
2. An alternative, could be to *allow* empty columns in the case of an all
null-array. This would allow avoiding the allocation. But... I don't think this
is supported elsewhere, and seems like an extensive change. Hence, I'm guessing
the first is the right solution.
--
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]