Describe the bug
If we have None as the first element in ListArray, it panics when we call cast_with_options
To Reproduce
#[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), None, 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
Should return correct casted array
Additional context