Support ListView in length kernel#9346
Conversation
53d37b9 to
ea90baf
Compare
codephage2020
left a comment
There was a problem hiding this comment.
The PR is good as-is for the length kernel. However, consider also adding bit_length support in a follow-up or in this same PR:
DataType::ListView(_) => {
let list = array.as_list_view::<i32>();
let v: Vec<i32> = list.sizes().iter().map(|s| s.wrapping_mul(8)).collect();
Ok(Arc::new(Int32Array::new(v.into(), list.nulls().cloned())))
}
DataType::LargeListView(_) => {
let list = array.as_list_view::<i64>();
let v: Vec<i64> = list.sizes().iter().map(|s| s.wrapping_mul(8)).collect();
Ok(Arc::new(Int64Array::new(v.into(), list.nulls().cloned())))
}|
Nice one @codephage2020! Can do that here. Thanks for providing the code! |
ea90baf to
243087f
Compare
|
Actually, I don't think it makes sense to support list types in I know we have existing support for regular List/LargeList, but this seems to be introduced in error by #4718 as far as I can tell. It doesn't make sense to compute bit length of lists based on the assumption that each element of the list = 1 byte. |
Oh I see. Thanks. I'll remove it then. |
243087f to
4a95abd
Compare
|
Done! |
@Jefffrey Exactly. After reviewing the code,
@vegarsti Could you also remove the existing List/LargeList support for |
|
I've raised a separate issue for removing the existing implementation: I think it would be better to leave this PR as improving support for ListViews only, and have a separate PR for a potentially behavioural change |
|
To clarify, you still approve this @Jefffrey? 🙏🏻 |
|
Yes |
|
Thanks @vegarsti & @codephage2020 |
Which issue does this PR close?
Closes #9343.
Are these changes tested?
Yes, added tests