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

Add Take for REEArray #162

Merged
merged 2 commits into from
Mar 28, 2024
Merged

Add Take for REEArray #162

merged 2 commits into from
Mar 28, 2024

Conversation

robert3005
Copy link
Member

No description provided.

@robert3005 robert3005 changed the title Add take for REEArray Add Take for REEArray Mar 28, 2024
})
.collect::<VortexResult<Vec<_>>>()?
});
take(self.values(), &PrimitiveArray::from(physical_indices))
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same pattern that happens in Dict array, repeated value take on some dictionary.

@robert3005 robert3005 merged commit f3ce3ac into develop Mar 28, 2024
2 checks passed
@robert3005 robert3005 deleted the rk/reetake branch March 28, 2024 08:35
impl TakeFn for REEArray {
fn take(&self, indices: &dyn Array) -> VortexResult<ArrayRef> {
let primitive_indices = flatten_primitive(indices)?;
let physical_indices = match_each_integer_ptype!(primitive_indices.ptype(), |$P| {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should just be a search_sorted? Possibly this? #164

Copy link
Contributor

Choose a reason for hiding this comment

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

That said, an iterator would allow us to apply the offset inline without allocating a new buffer

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just search sorted. That’s what find_physical_index does

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, but a lot of function calls, vs search_sorted_many

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants