-
Notifications
You must be signed in to change notification settings - Fork 113
chore: TakeKernel for List
#3750
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
Conversation
| for &idx in indices { | ||
| let idx = idx | ||
| .to_usize() | ||
| .ok_or_else(|| vortex_err!("Failed to convert index to usize: {}", idx))?; | ||
|
|
||
| let elem = array.scalar_at(idx)?; | ||
| builder.append_value(elem.as_list())?; | ||
| } | ||
| Ok(builder.finish()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not implement this using a take on the elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scalar at is very slow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea, should we faster now 🙌🏻
7e9ce5f to
6ac29aa
Compare
1404dbf to
0034dfe
Compare
Signed-off-by: blaginin <dima@spiraldb.com>
3a4b5d3 to
082dcc6
Compare
| let elements_to_take = elements_to_take.finish(); | ||
| let new_offsets = new_offsets.finish(); | ||
|
|
||
| let new_elements = crate::compute::take(array.elements(), elements_to_take.as_ref())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import this take
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
|
||
| let mut current_offset = O::zero(); | ||
| new_offsets.append_zero(); | ||
| let mut new_validity = BoolBuilder::with_capacity(Nullability::NonNullable, 2 * indices.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are building validity here I would use arrow's BooleanBufferBuilder
| let new_offsets = new_offsets.finish(); | ||
| let new_elements = crate::compute::take(array.elements(), elements_to_take.as_ref())?; | ||
|
|
||
| let new_validity: Validity = Validity::Array(new_validity.finish()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then this is just Validitity::from(new_validity.finish())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, 55626b9
Signed-off-by: blaginin <dima@spiraldb.com>
Signed-off-by: blaginin <dima@spiraldb.com>
Very similar to https://github.com/vortex-data/vortex/blob/develop/vortex-array/src/arrays/varbin/compute/take.rs but annoyingly can't unify