Skip to content

Conversation

@blaginin
Copy link
Member

@blaginin blaginin commented Jul 3, 2025

@blaginin blaginin self-assigned this Jul 3, 2025
@blaginin blaginin added the chore Release label indicating a trivial change label Jul 3, 2025
@blaginin blaginin marked this pull request as ready for review July 3, 2025 13:43
@blaginin blaginin requested a review from joseph-isaacs July 3, 2025 13:47
Comment on lines 50 to 58
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())
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Member Author

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 🙌🏻

@blaginin blaginin marked this pull request as draft July 3, 2025 18:01
@blaginin blaginin force-pushed the db/take-for-array branch from 7e9ce5f to 6ac29aa Compare July 3, 2025 21:45
@blaginin blaginin marked this pull request as ready for review July 3, 2025 21:45
@blaginin blaginin force-pushed the db/take-for-array branch from 1404dbf to 0034dfe Compare July 3, 2025 21:52
@blaginin blaginin requested a review from joseph-isaacs July 3, 2025 21:54
Signed-off-by: blaginin <dima@spiraldb.com>
@blaginin blaginin force-pushed the db/take-for-array branch from 3a4b5d3 to 082dcc6 Compare July 3, 2025 21:58
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())?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import this take

Copy link
Member Author

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());
Copy link
Contributor

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());
Copy link
Contributor

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())

Copy link
Member Author

@blaginin blaginin Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, 55626b9

blaginin added 3 commits July 4, 2025 15:18
Signed-off-by: blaginin <dima@spiraldb.com>
Signed-off-by: blaginin <dima@spiraldb.com>
Signed-off-by: blaginin <dima@spiraldb.com>
@blaginin blaginin enabled auto-merge (squash) July 4, 2025 14:28
@blaginin blaginin merged commit e3893d3 into develop Jul 4, 2025
31 checks passed
@blaginin blaginin deleted the db/take-for-array branch July 4, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Release label indicating a trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants