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

Closed
jayzhan211 opened this issue Jan 29, 2025 · 2 comments · Fixed by #7065
Closed

First None in ListArray panics in cast_with_options #7043

jayzhan211 opened this issue Jan 29, 2025 · 2 comments · Fixed by #7065
Assignees
Labels
arrow Changes to the arrow crate bug good first issue Good for newcomers help wanted

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
Contributor

irenjj commented Jan 31, 2025

take

@alamb
Copy link
Contributor

alamb commented Feb 10, 2025

label_issue.py automatically added labels {'arrow'} from #7065

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug good first issue Good for newcomers help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@alamb @jayzhan211 @irenjj and others