@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 Block getRegion(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); return new VariableWidthBlock(positionOffset, length, sliceOutput.slice(), offsets, hasNullValue ? valueIsNull : null); }
@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 Block copyRegion(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); int[] newOffsets = compactOffsets(offsets, positionOffset, length); boolean[] newValueIsNull = null; if (hasNullValue) { newValueIsNull = compactArray(valueIsNull, positionOffset, length); } Slice slice = compactSlice(sliceOutput.getUnderlyingSlice(), offsets[positionOffset], newOffsets[length]); return new VariableWidthBlock(0, length, slice, newOffsets, newValueIsNull); }
@Override public Block getRegion(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); return new VariableWidthBlock(positionOffset, length, sliceOutput.slice(), offsets, hasNullValue ? valueIsNull : null); }
@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 Block copyRegion(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); int[] newOffsets = compactOffsets(offsets, positionOffset, length); boolean[] newValueIsNull = null; if (hasNullValue) { newValueIsNull = compactArray(valueIsNull, positionOffset, length); } Slice slice = compactSlice(sliceOutput.getUnderlyingSlice(), offsets[positionOffset], newOffsets[length]); return new VariableWidthBlock(0, length, slice, newOffsets, newValueIsNull); }