-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-5199:[Java] Add unsafe access methods to ArrowBuf #4186
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
This reverts commit b56393f.
Codecov Report
@@ Coverage Diff @@
## master #4186 +/- ##
==========================================
+ Coverage 87.77% 87.83% +0.06%
==========================================
Files 758 758
Lines 92442 92975 +533
Branches 1251 1251
==========================================
+ Hits 81145 81669 +524
- Misses 11180 11189 +9
Partials 117 117
Continue to review full report at Codecov.
|
|
I'd like to propose that we get ARROW-3191 merged first and then change how to do this. I think it probably makes sense to simply implement an UncheckedBuf which can simply be a set of accessors along with a memory address that interacts with the underlying memory via unchecked methods. The generic can hold a reference object (which may be ArrowBuf) but could be anything else, too. Since the address is exposed in ArrowBuf, you can grab that to create an UncheckedBuf. There is no need for these methods to be directly attached to the ArrowBuf class. |
Sure, it makes sense to merge ARROW-3191 first. I would prefer having explicit unsafe method so that the external caller would be aware that such a method have no boundary check. If we simply providing an UncheckedBuf implementation it could be quite confusing about the semantics of each accessor. |
|
The UncheckedBuf can have the methods be called getUnsafe(). UncheckedBuf is not a subclass of ArrowBuf, it is simply something that holds a reference to ArrowBuf. |
|
@yuruiz can you clarify the use case for this? Does using the BoundsChecking configuration not work for you? |
HI @emkornfield , by boundsChecking flag are you referring the flag introduced by this PR ? I can update it if that is the preferred way. |
|
That flag is for verifying a value is set when retrieving. I was referring to this which is the same thing for checking bounds on addresses. |
That looks good. I would close this PR. |
Add unsafe access method to ArrowBuf to allow external user to access underlying memory chunk without extra boundary check overhead