-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-11345: [Rust] Made most ops not rely on value(i)
#9291
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
|
cc @tyrelr . |
rust/arrow/src/array/ord.rs
Outdated
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.
this will be slower, but at this point we have no guarantee that i and j are within bounds.
Codecov Report
@@ Coverage Diff @@
## master #9291 +/- ##
=======================================
Coverage 81.88% 81.89%
=======================================
Files 215 215
Lines 52988 52972 -16
=======================================
- Hits 43391 43379 -12
+ Misses 9597 9593 -4
Continue to review full report at Codecov.
|
value(i)value(i)
nevi-me
left a comment
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.
@jorgecarleitao this needs a rebase
| } | ||
|
|
||
| Ok(Arc::new(b.finish()) as ArrayRef) | ||
| // todo: can be optimized by computing this for the whole values buffer and |
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.
we can open a JIRA to track this. I think 'unary' can also work (or was this before the cast improvement?)
d4608a9 to
356c300
Compare
|
@jorgecarleitao is this PR something that you plan to clean up and merge? Or should we close this PR as you have switched to working on arrow 2? |
Problem
Currently, a lot of our code relies on
PrimitiveArray::value(usize), however, that method isunsafe(but not marked as such!): anyusizelarger than the length of the array allows to read arbitrary memory regions due to the lack of bound checks.This PR:
This PR changes some of our kernels to not rely on it for this operation, replacing by a safe alternative. This PR is expected to affect the performance of the touched kernels, either improving as we already have alternatives to efficiently create an array out of an iterator, or decreasing (when the index bound is indeed unknown).
todo: benchmark