ARROW-5476: [Java][Memory] Fix Netty Arrow Buf.#4451
ARROW-5476: [Java][Memory] Fix Netty Arrow Buf.#4451praveenbingo wants to merge 11 commits intoapache:masterfrom
Conversation
praveenbingo
commented
Jun 2, 2019
- Fixes the slice to use indexes in netty arrow buf, arrow buffer may not track the right indexes.
|
@praveenbingo Thanks for finding this problem. Would you please provide a unit test for it? |
Codecov Report
@@ Coverage Diff @@
## master #4451 +/- ##
==========================================
+ Coverage 88.27% 89.47% +1.19%
==========================================
Files 846 645 -201
Lines 103662 89845 -13817
Branches 1253 0 -1253
==========================================
- Hits 91512 80392 -11120
+ Misses 11903 9453 -2450
+ Partials 247 0 -247Continue to review full report at Codecov.
|
There was a problem hiding this comment.
this creates another dependency on netty in the ReferenceManager, which we want to avoid.
what's wrong with the earlier implementation of getDirectBuffer ?
There was a problem hiding this comment.
should this be 'length - index' ?
There was a problem hiding this comment.
It should be..fixed and added a test
There was a problem hiding this comment.
this one is different from nioBuffer(index, length) - position is different, limit is different. is that intentional ?
There was a problem hiding this comment.
Yes, this is the implementation for this API by other ByteBuf classes inside Netty like PooledUnsafeDirectByteBuf. So following the same convention.
There was a problem hiding this comment.
seems indirect - getDirectBuffer already moves the addr by index. position(index) - will effectively move it to 2 * index
There was a problem hiding this comment.
Good catch :( Fixed now.
There was a problem hiding this comment.
can you please add a comment saying that the returned buffer is zero-positioned ?
There was a problem hiding this comment.
can you pls add more values ?
for ( intValue : {Integer.MIN_VALUE, Short.MIN_VALUE -1, Short.MIN_VALUE, 0, SHORT.MAX_VALUE, Short.MAX_VALUE + 1, Integer.MAX_VALUE}) { .. }
- Fixes the slice to use indexes in netty arrow buf.
- Fixed internalNioBuffer - Fixed littleEndian getters and setters - Fixed get/set for composite buffers
- Fixes the slice to use indexes in netty arrow buf, arrow buffer may not track the right indexes. Author: Praveen <praveen@dremio.com> Closes apache#4451 from praveenbingo/ARROW-5476 and squashes the following commits: 9ef785a <Praveen> Fix review comments. e82c22a <Praveen> Address review comments. 58747f3 <Praveen> Fix lint issues. 60f8d7d <Praveen> Fix more APIs b2b364b <Praveen> Fixed length of created direct buffer. 6ea540a <Praveen> Remove unused import. b9d87b3 <Praveen> Add test to ensure nio buffer is positioned correctly. 61b3773 <Praveen> Fix review comments. 3d7579b <Praveen> Fix some more API. c6344ac <Praveen> Add a test for the slice method. 5724481 <Praveen> ARROW-5476: Fix Netty Arrow Buf slice.