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

Support FixedSizedListArray for length kernel #4517

Closed
alamb opened this issue Jul 13, 2023 · 2 comments · Fixed by #4520
Closed

Support FixedSizedListArray for length kernel #4517

alamb opened this issue Jul 13, 2023 · 2 comments · Fixed by #4520
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Jul 13, 2023

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

While implement unnest in DataFusion for FixedSizeListArray (see apache/datafusion#6903) it turns out there is no support for FixedSizeListArray in the length kernel

https://docs.rs/arrow/latest/arrow/compute/kernels/length/fn.length.html

Describe the solution you'd like
While it sounds silly, I would like to Support FixedSizedListArray for length kernel

Specifically, it would be nice to get the NULLs handled correctly even though all the values will of course be the same (fixed!) size lenth

Here is a reproducer:

fn main() {
    // Construct a value array
    let value_data = ArrayData::builder(DataType::Int32)
        .len(9)
        .add_buffer(Buffer::from_slice_ref(&[0, 1, 2, 3, 4, 5, 6, 7, 8]))
        .build()
        .unwrap();
    let list_data_type = DataType::FixedSizeList(
        Arc::new(Field::new("item", DataType::Int32, false)),
        3,
    );
    let nulls = NullBuffer::from(vec![true, false, true]);
    let list_data = ArrayData::builder(list_data_type.clone())
        .len(3)
        .add_child_data(value_data.clone())
        .nulls(Some(nulls))
        .build()
        .unwrap();
    let list_array = FixedSizeListArray::from(list_data);


    let lengths = arrow::compute::kernels::length::length(&list_array).unwrap();
    println!("{}", pretty_format_columns("lengths", &[lengths]).unwrap());

}

It should print out [3, null, 3]

Describe alternatives you've considered

Additional context

@alamb alamb added enhancement Any new improvement worthy of a entry in the changelog arrow Changes to the arrow crate good first issue Good for newcomers labels Jul 13, 2023
@alamb
Copy link
Contributor Author

alamb commented Jul 13, 2023

I think this is a good first issue as it is well specified and has a reproducer

@Weijun-H
Copy link
Contributor

willing to take this issue.

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 enhancement Any new improvement worthy of a entry in the changelog good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants