-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
refactor(rust): Trim sliced-out memory from ListArrays in list arithmetic #19276
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19276 +/- ##
==========================================
+ Coverage 80.11% 80.13% +0.01%
==========================================
Files 1526 1526
Lines 209338 209359 +21
Branches 2418 2418
==========================================
+ Hits 167707 167761 +54
+ Misses 41081 41048 -33
Partials 550 550 ☔ View full report in Codecov by Sentry. |
@@ -58,10 +58,12 @@ impl NumericListOp { | |||
rhs.len(), | |||
{ | |||
let (a, b) = lhs.list_offsets_and_validities_recursive(); | |||
assert!(a.iter().all(|x| *x.first() as usize == 0)); |
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 make this debug_assert
?
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.
added
/// Returns an iterator over the offsets of this chunked array. | ||
/// | ||
/// The offsets are returned as though the array consisted of a single chunk. | ||
pub fn iter_offsets(&self) -> impl Iterator<Item = i64> + '_ { |
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.
remove unused code
For example, given this ListArray:
Currently, the list arithmetic kernel would:
10_000
values, when we only need5002 - 5000 = 2
valuesArithmeticKernel
on all 10,000 values, when we only need to call it on a slicevalues[5000..5002]
of 2 values.This can be a performance footgun if one performs list arithmetic across sliced chunks of a DataFrame - we would end up performing allocation/compute on the entire DataFrame for every chunk.
This PR trims the sliced-out memory from the ListArrays so that we don't over-allocate / perform compute on sliced-out memory.