Yes, we should only set reader/writer index on getBuffers() On Thu, Nov 9, 2017 at 11:13 AM, Li Jin <ice.xell...@gmail.com> wrote:
> I see. Is this understanding correct? > > For ArrowBufs in vector classes, their reader/writerIndex are 0. Only when > writing out a record batch, the writerIndex in ArrowBufs is then set > correctly. > > > > On Thu, Nov 9, 2017 at 1:28 PM, Siddharth Teotia <siddha...@dremio.com> > wrote: > > > ReaderIndex and WriterIndex are important when we get the buffers (for > > sending over the wire). We get the buffers from one or more vectors, > build > > a compound buffer and slice it on the other end when reconstructing the > > vectors. Writer index helps in demarcating the exact end point of last > > written data. > > > > When I started to write the patches for refactoring, I wasn't quite sure > > about their use but later on learnt it and appropriately set the indexes > in > > required places in vector code. > > > > > > > > On Thu, Nov 9, 2017 at 9:28 AM, Li Jin <ice.xell...@gmail.com> wrote: > > > > > Hi All, > > > > > > I am reading Java vector refactor code and come cross > > > readerIndex/writerIndex on ArrowBuf. This issue has been brought up by > > > Siddharth > > > Teotia earlier but I might have missed the discussion so what to > clarify. > > > > > > My understanding is that the current implementation in java refactor > > branch > > > ignore reader/writerIndex on ArrowBuf. None of the arrow code sets or > > uses > > > reader/writerIndex on ArrowBuf. > > > > > > I'd like to get thoughts from people regarding this issue: > > > (1) Ignoring readerIndex/writerIndex is good because ... > > > (2) Ignoring readerIndex/writerIndex is bad because... > > > > > > The before refactor code - it seems somewhat inconsistent with this > > matter > > > - there are code that uses reader/writerIndex but the "set" method > > doesn't > > > seem to advance writerIndex. > > > > > >