File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
vector/src/main/java/org/apache/arrow/vector Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -379,8 +379,10 @@ private void setReaderAndWriterIndex() {
379379 validityBuffer .writerIndex (BitVectorHelper .getValidityBufferSizeFromCount (valueCount ));
380380 valueBuffer .writerIndex (lastDataOffset );
381381 }
382- // Per Arrow spec, offset buffer always has (valueCount + 1) entries including offset[0]=0.
383- // This ensures IPC serialization includes the offset buffer even when valueCount is 0.
382+ // IPC serializer will determine readable bytes based on `readerIndex` and `writerIndex`.
383+ // Both are set to 0 means 0 bytes are written to the IPC stream which will crash IPC readers
384+ // in other libraries. According to Arrow spec, we should still output the offset buffer which
385+ // is [0].
384386 offsetBuffer .writerIndex ((long ) (valueCount + 1 ) * OFFSET_WIDTH );
385387 }
386388
Original file line number Diff line number Diff line change @@ -395,8 +395,10 @@ private void setReaderAndWriterIndex() {
395395 validityBuffer .writerIndex (BitVectorHelper .getValidityBufferSizeFromCount (valueCount ));
396396 valueBuffer .writerIndex (lastDataOffset );
397397 }
398- // Per Arrow spec, offset buffer always has (valueCount + 1) entries including offset[0]=0.
399- // This ensures IPC serialization includes the offset buffer even when valueCount is 0.
398+ // IPC serializer will determine readable bytes based on `readerIndex` and `writerIndex`.
399+ // Both are set to 0 means 0 bytes are written to the IPC stream which will crash IPC readers
400+ // in other libraries. According to Arrow spec, we should still output the offset buffer which
401+ // is [0].
400402 offsetBuffer .writerIndex ((long ) (valueCount + 1 ) * OFFSET_WIDTH );
401403 }
402404
You can’t perform that action at this time.
0 commit comments