Source:
<code>public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } for (StreamReader structField : structFields) { structField.prepareNextRead(readOffset); } } List<Type> typeParameters = type.getTypeParameters(); boolean[] nullVector = new boolean[nextBatchSize]; Block[] blocks = new Block[typeParameters.size()]; if (presentStream == null) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { blocks[i] = getNullBlock(typeParameters.get(i)); } } } else { int nullValues = presentStream.getUnsetBits(nextBatchSize, nullVector); if (nullValues != nextBatchSize) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize - nullValues); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { <START> blocks[i] = getNullBlock(typeParameters.get(i)); <END> } } } else { for (int i = 0; i < typeParameters.size(); i++) { blocks[i] = typeParameters.get(i).createBlockBuilder(null, 0).build(); } } } Block rowBlock = RowBlock.fromFieldBlocks(nullVector, blocks); readOffset = 0; nextBatchSize = 0; return rowBlock; }</code><technical_language>This create a block null entry struct, some of structs null. Instead create a block nextBatchSize - nullValues entries. catch this kind of mistake this if/else: java verify(Arrays.stream(blocks) .mapToInt(Block::getPositionCount) .distinct() .count() == 1);</technical_language>

Target:
public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } for (StreamReader structField : structFields) { structField.prepareNextRead(readOffset); } } List<Type> typeParameters = type.getTypeParameters(); boolean[] nullVector = new boolean[nextBatchSize]; Block[] blocks = new Block[typeParameters.size()]; if (presentStream == null) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { blocks[i] = getNullBlock(typeParameters.get(i), nextBatchSize); } } } else { int nullValues = presentStream.getUnsetBits(nextBatchSize, nullVector); if (nullValues != nextBatchSize) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize - nullValues); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { blocks[i] = getNullBlock(typeParameters.get(i), nextBatchSize - nullValues); } } } else { for (int i = 0; i < typeParameters.size(); i++) { blocks[i] = typeParameters.get(i).createBlockBuilder(null, 0).build(); } } } verify(Arrays.stream(blocks) .mapToInt(Block::getPositionCount) .distinct() .count() == 1); Block rowBlock = RowBlock.fromFieldBlocks(nullVector, blocks); readOffset = 0; nextBatchSize = 0; return rowBlock; }