Source:
public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(type); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } if (readOffset > 0) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is not present"); } if (inDictionaryStream != null) { inDictionaryStream.skip(readOffset); } dataStream.skip(readOffset); } } assureVectorSizes(); int[] dataVector = new int[nextBatchSize]; int dataVectorOffset = 0; while (nextBatchSize > dataVectorOffset) { int subBatchSize = min(nextBatchSize - dataVectorOffset, MAX_BATCH_SIZE); if (presentStream == null) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is not present"); } Arrays.fill(isNullVector, false); dataStream.nextIntVector(subBatchSize, dataVector, dataVectorOffset); } else { int nullValues = presentStream.getUnsetBits(subBatchSize, isNullVector); if (nullValues != subBatchSize) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is not present"); } dataStream.nextIntVector(subBatchSize, dataVector, dataVectorOffset, isNullVector, 0); } } if (inDictionaryStream == null) { Arrays.fill(inDictionaryVector, true); } else { inDictionaryStream.getSetBits(subBatchSize, inDictionaryVector, isNullVector); } for (int i = 0; i < subBatchSize; i++) { int dataVectorIndex = i + dataVectorOffset; if (isNullVector[i]) { dataVector[dataVectorIndex] = dictionaryBlock.getPositionCount() - 1; } else if (inDictionaryVector[i]) { } else { dataVector[dataVectorIndex] += stripeDictionarySize; } } dataVectorOffset += subBatchSize; } Block block = new DictionaryBlock(nextBatchSize, dictionaryBlock, dataVector); readOffset = 0; nextBatchSize = 0; return block; }

Target:
public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(type); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } if (readOffset > 0) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is not present"); } if (inDictionaryStream != null) { inDictionaryStream.skip(readOffset); } dataStream.skip(readOffset); } } assureVectorSize(); int[] idsVector = new int[nextBatchSize]; int idsVectorOffset = 0; while (nextBatchSize > idsVectorOffset) { int subBatchSize = min(nextBatchSize - idsVectorOffset, MAX_BATCH_SIZE); if (presentStream == null) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is not present"); } Arrays.fill(isNullVector, false); dataStream.nextIntVector(subBatchSize, idsVector, idsVectorOffset); } else { int nullValues = presentStream.getUnsetBits(subBatchSize, isNullVector); if (nullValues != subBatchSize) { if (dataStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is not present"); } dataStream.nextIntVector(subBatchSize, idsVector, idsVectorOffset, isNullVector); } } if (inDictionaryStream == null) { Arrays.fill(inDictionaryVector, true); } else { inDictionaryStream.getSetBits(subBatchSize, inDictionaryVector, isNullVector); } for (int i = 0; i < subBatchSize; i++) { int dataVectorIndex = i + idsVectorOffset; if (isNullVector[i]) { idsVector[dataVectorIndex] = dictionaryBlock.getPositionCount() - 1; } else if (inDictionaryVector[i]) { } else { idsVector[dataVectorIndex] += stripeDictionarySize; } } idsVectorOffset += subBatchSize; } Block block = new DictionaryBlock(nextBatchSize, dictionaryBlock, idsVector); readOffset = 0; nextBatchSize = 0; return block; }