Source:
public Block readBlock(Type type) throws IOException { DecimalType decimalType = (DecimalType) type; if (!rowGroupOpen) { openRowGroup(); } seekToOffset(); int subBatchSize = Math.min(nextBatchSize, MAX_BATCH_SIZE); allocateVectors(subBatchSize); BlockBuilder builder = decimalType.createBlockBuilder(null, nextBatchSize); while (nextBatchSize > 0) { int elemsToRead = Math.min(nextBatchSize, subBatchSize); if (presentStream == null) { if (decimalStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but decimal stream is not present"); } if (scaleStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but scale stream is not present"); } scaleStream.nextLongVector(elemsToRead, scaleVector); if (decimalType.isShort()) { decimalStream.nextShortDecimalVector(elemsToRead, builder, decimalType, scaleVector); } else { decimalStream.nextLongDecimalVector(elemsToRead, builder, decimalType, scaleVector); } } else { int nullValues = presentStream.getUnsetBits(elemsToRead, nullVector); if (nullValues != elemsToRead) { if (decimalStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but decimal stream is not present"); } if (scaleStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but scale stream is not present"); } scaleStream.nextLongVector(elemsToRead, scaleVector, nullVector); if (decimalType.isShort()) { decimalStream.nextShortDecimalVector(elemsToRead, builder, decimalType, scaleVector, nullVector); } else { decimalStream.nextLongDecimalVector(elemsToRead, builder, decimalType, scaleVector, nullVector); } } else { for (int i = 0; i < elemsToRead; i++) { builder.appendNull(); } } } nextBatchSize -= elemsToRead; } readOffset = 0; nextBatchSize = 0; return builder.build(); }

Target:
public Block readBlock(Type type) throws IOException { DecimalType decimalType = (DecimalType) type; if (!rowGroupOpen) { openRowGroup(); } seekToOffset(); assureVectorSize(); BlockBuilder builder = decimalType.createBlockBuilder(null, nextBatchSize); while (nextBatchSize > 0) { int subBatchSize = min(nextBatchSize, MAX_BATCH_SIZE); if (presentStream == null) { if (decimalStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but decimal stream is not present"); } if (scaleStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but scale stream is not present"); } scaleStream.nextLongVector(subBatchSize, scaleVector); if (decimalType.isShort()) { decimalStream.nextShortDecimalVector(subBatchSize, builder, decimalType, scaleVector); } else { decimalStream.nextLongDecimalVector(subBatchSize, builder, decimalType, scaleVector); } } else { int nullValues = presentStream.getUnsetBits(subBatchSize, nullVector); if (nullValues != subBatchSize) { if (decimalStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but decimal stream is not present"); } if (scaleStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but scale stream is not present"); } scaleStream.nextLongVector(subBatchSize, scaleVector, nullVector); if (decimalType.isShort()) { decimalStream.nextShortDecimalVector(subBatchSize, builder, decimalType, scaleVector, nullVector); } else { decimalStream.nextLongDecimalVector(subBatchSize, builder, decimalType, scaleVector, nullVector); } } else { for (int i = 0; i < subBatchSize; i++) { builder.appendNull(); } } } nextBatchSize -= subBatchSize; } readOffset = 0; nextBatchSize = 0; return builder.build(); }