Skip to content

Commit 1a1bb75

Browse files
committed
MINOR: Add explicit exception when no more buffer can be read when loading buffers
1 parent 26e14f0 commit 1a1bb75

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vector/src/main/java/org/apache/arrow/vector/VectorLoader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ private void loadBuffers(
122122
(int) (variadicBufferLayoutCount + TypeLayout.getTypeBufferCount(field.getType()));
123123
List<ArrowBuf> ownBuffers = new ArrayList<>(bufferLayoutCount);
124124
for (int j = 0; j < bufferLayoutCount; j++) {
125+
if (!buffers.hasNext()) {
126+
throw new IllegalArgumentException(
127+
"no more buffers for field " + field + ". Expected " + bufferLayoutCount);
128+
}
125129
ArrowBuf nextBuf = buffers.next();
126130
// for vectors without nulls, the buffer is empty, so there is no need to decompress it.
127131
ArrowBuf bufferToAdd =

0 commit comments

Comments
 (0)