[
https://issues.apache.org/jira/browse/ARROW-7494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17009168#comment-17009168
]
Jacques Nadeau commented on ARROW-7494:
---------------------------------------
What I'm saying:
Reader and writer index are typically used to decide what portion of data needs
to be written to a socket. For example, if you have a buffer that is 10 bytes
but you only want to write bytes 2..4 to the buffer, you'll need to set the
reader index to two and the writer index to 4. By so doing, you can then hand
that buffer to someone and they will only write the two selected bytes.
In the case of ArrowBuf, we have the concept of slices. As such, in cases where
we're currently relying on reader/writer index to write the correct bytes to an
io location, we should change the code to get the appropriate slice of the
underlying buffer instead and simply write the whole thing. For example, I
believe the getBuffers() has the behavior of changing reader/writer indexes to
solve this. For example, if you do getBuffers() on a valuecount of 1 for an int
vector, I believe we set the writer index to 4 bytes but return the whole large
buffer. Instead, here we want to do the slice of bytes 0..4.
> [Java] Remove reader index and writer index from ArrowBuf
> ---------------------------------------------------------
>
> Key: ARROW-7494
> URL: https://issues.apache.org/jira/browse/ARROW-7494
> Project: Apache Arrow
> Issue Type: Task
> Components: Java
> Reporter: Jacques Nadeau
> Assignee: Ji Liu
> Priority: Critical
> Fix For: 1.0.0
>
>
> Reader and writer index and functionality doesn't belong on a chunk of memory
> and is due to inheritance from ByteBuf. As part of removing ByteBuf
> inheritance, we should also remove reader and writer indexes from ArrowBuf
> functionality. It wastes heap memory for rare utility. In general, a slice
> can be used instead of a reader/writer index pattern.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)