Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First None in ListArray panics in cast_with_options #7043

Open
jayzhan211 opened this issue Jan 29, 2025 · 1 comment · May be fixed by #7065
Open

First None in ListArray panics in cast_with_options #7043

jayzhan211 opened this issue Jan 29, 2025 · 1 comment · May be fixed by #7065
Assignees
Labels

Comments

@jayzhan211
Copy link
Contributor

jayzhan211 commented Jan 29, 2025

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

@jayzhan211 jayzhan211 added the bug label Jan 29, 2025
@alamb alamb added help wanted good first issue Good for newcomers labels Jan 30, 2025
@irenjj
Copy link

irenjj commented Jan 31, 2025

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@alamb @jayzhan211 @irenjj and others