vibhatha commented on code in PR #43077: URL: https://github.com/apache/arrow/pull/43077#discussion_r1689548843
########## java/vector/src/main/java/org/apache/arrow/vector/ipc/JsonFileWriter.java: ########## @@ -277,6 +281,14 @@ private void writeFromVectorIntoJson(Field field, FieldVector vector) throws IOE vectorBufferTmp.setLong(0, 0); writeValueToGenerator(bufferType, vectorBufferTmp, null, vector, i); } + } else if (bufferType.equals(SIZE) + && vector.getValueCount() == 0 + && vector.getMinorType() == MinorType.LISTVIEW) { + // Empty vectors may not have allocated a sizes buffer + try (ArrowBuf vectorBufferTmp = vector.getAllocator().buffer(4)) { + vectorBufferTmp.setInt(0, 0); + writeValueToGenerator(bufferType, vectorBufferTmp, null, vector, i); + } Review Comment: Gathering my thoughts, I think the reason for doing this was basically to accommodate what was done to offset. There the current logic sets the a buffer with a single value. I think I naively followed the same approach. You have a point here, let me further test this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org