-
Notifications
You must be signed in to change notification settings - Fork 115
Remove unnecessary work from ListArray::validate
#6004
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
| if let Some(min) = min_max.min.as_primitive().as_::<P>() { | ||
| vortex_ensure!( | ||
| min >= 0 && min <= max_offset, | ||
| min >= 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.
at this point we know min is lt_eq the last element, because the offsets array is sorted
| ); | ||
| } | ||
|
|
||
| if let Some(max) = min_max.max.as_primitive().as_::<P>() { |
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.
max == max_offset, and if min is >=, so should it be for the same reasons
|
Because we check is_sorted this is indeed unnecessary |
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // the elements array. | ||
| if let Some(min_max) = min_max(offsets)? { | ||
| match_each_integer_ptype!(offsets_ptype, |P| { | ||
| let max_offset = P::try_from(offsets.scalar_at(offsets.len() - 1)) |
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.
dont do
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!
Signed-off-by: Adam Gutglick <[email protected]>
3a5f61c to
47353a8
Compare
This PR removes some unnecessary work, relying on the previous assertion that the offsets array is sorted.