@Override protected int getPositionOffset(int position) { checkValidPosition(position, positions); return getOffset(position); }
@Override public long getRegionSizeInBytes(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); long arraysSizeInBytes = (Integer.BYTES + Byte.BYTES) * (long) length; return getOffset(positionOffset + length) - getOffset(positionOffset) + arraysSizeInBytes; }
@Override public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, getPositionCount()); long sizeInBytes = 0; int usedPositionCount = 0; for (int i = 0; i < positions.length; ++i) { if (positions[i]) { usedPositionCount++; sizeInBytes += getOffset(i + 1) - getOffset(i); } } return sizeInBytes + (Integer.BYTES + Byte.BYTES) * (long) usedPositionCount; }
@Override public BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus) { int currentSizeInBytes = positions == 0 ? positions : (getOffset(positions) - getOffset(0)); return new VariableWidthBlockBuilder(blockBuilderStatus, calculateBlockResetSize(positions), calculateBlockResetBytes(currentSizeInBytes)); }
@Override protected int getPositionOffset(int position) { checkValidPosition(position, positions); return getOffset(position); }
@Override public long getRegionSizeInBytes(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); long arraysSizeInBytes = (Integer.BYTES + Byte.BYTES) * (long) length; return getOffset(positionOffset + length) - getOffset(positionOffset) + arraysSizeInBytes; }
@Override public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, getPositionCount()); long sizeInBytes = 0; int usedPositionCount = 0; for (int i = 0; i < positions.length; ++i) { if (positions[i]) { usedPositionCount++; sizeInBytes += getOffset(i + 1) - getOffset(i); } } return sizeInBytes + (Integer.BYTES + Byte.BYTES) * (long) usedPositionCount; }
@Override public BlockBuilder newBlockBuilderLike(BlockBuilderStatus blockBuilderStatus) { int currentSizeInBytes = positions == 0 ? positions : (getOffset(positions) - getOffset(0)); return new VariableWidthBlockBuilder(blockBuilderStatus, calculateBlockResetSize(positions), calculateBlockResetBytes(currentSizeInBytes)); }