rluvaton opened a new issue, #9302:
URL: https://github.com/apache/arrow-rs/issues/9302
**Describe the bug**
You can create a `StructArray` with field marked as non nullable but the
child has nulls.
this should not be possible IMO as:
1. struct field nullability has no meaning
2. you can't have functions asserting non nullable field array has no nulls
**To Reproduce**
```rust
#[test]
fn reproduction() {
let child = Int8Array::from(vec![None]);
let child = Arc::new(child) as ArrayRef;
let struct_array = StructArray::try_new(
Fields::from(vec![
Field::new(
"f",
child.data_type().clone(),
// Note the false here
false
),
]),
vec![child],
// Creating null item
Some(NullBuffer::from(&[false])),
).expect_err("should fail as field nullability does not match the array
nullability");
}
```
**Expected behavior**
the test should pass and it should fail the creation of the `StructArray`
**Additional context**
changing this behavior will also require updating `ArrayData::new_null`
which pass nulls for the children of structs.
Also, I did not found any restriction in the arrow specification about that.
--
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]