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

Chunked take #447

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Chunked take #447

merged 2 commits into from
Jul 10, 2024

Conversation

gatesn
Copy link
Contributor

@gatesn gatesn commented Jul 10, 2024

  • Improves the performance of ChunkedArray::take for strict-sorted indices.
  • Makes subtraction wrapping instead of doing an expensive statistics test
  • Fixes PrimitiveArray slice to be zero-copy

@gatesn gatesn enabled auto-merge (squash) July 10, 2024 21:19
let contains_nulls = !subtract_from.logical_validity().all_valid();
let subtraction_result = if contains_nulls {
let sub_vec = subtract_from
.maybe_null_slice()
.iter()
.map(|&v: &T| v.saturating_sub(&to_subtract))
.map(|&v: &T| v.wrapping_sub(&to_subtract))
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we changing the behavior of this, and removing the assertions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The assertions are expensive since they require computing stats.
We could either just use checked subtraction and allow this to panic, or we pick between saturating and wrapping.

Tbh, I've never seen unchecked subtraction do anything other than wrap, so it seemed like the better choice. e.g. https://arrow.apache.org/docs/python/generated/pyarrow.compute.subtract.html

vortex-buffer/src/lib.rs Outdated Show resolved Hide resolved
@gatesn gatesn merged commit dba7012 into develop Jul 10, 2024
2 checks passed
@gatesn gatesn deleted the ngates/chunked-take branch July 10, 2024 22:23
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