jayzhan211 opened a new issue, #7043:
URL: https://github.com/apache/arrow-rs/issues/7043
**Describe the bug**
<!--
A clear and concise description of what the bug is.
-->
If we have `None` as the first element in ListArray, it panics when we call
`cast_with_options`
**To Reproduce**
<!--
Steps to reproduce the behavior:
-->
```rust
#[test]
fn test_first_none_will_panic() {
//Panic
let array =
Arc::new(ListArray::from_iter_primitive::<Int64Type,_,_>(vec![None,
Some(vec![Some(1), Some(2), Some(3)])])) as ArrayRef;
let data_type =
DataType::FixedSizeList(FieldRef::new(Field::new("item", DataType::Int64,
true)), 3);
let opt = CastOptions::default();
let r = cast_with_options(&array, &data_type, &opt);
}
#[test]
fn test_non_first_none_pass() {
//Panic
let array =
Arc::new(ListArray::from_iter_primitive::<Int64Type,_,_>(vec![Some(vec![Some(1),
Some(2), Some(3)])])) as ArrayRef;
let data_type =
DataType::FixedSizeList(FieldRef::new(Field::new("item", DataType::Int64,
true)), 3);
let opt = CastOptions::default();
let r = cast_with_options(&array, &data_type, &opt);
}
```
**Expected behavior**
<!--
A clear and concise description of what you expected to happen.
-->
Should return correct casted array
**Additional context**
<!--
Add any other context about the problem here.
-->
--
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]