public int getId(int position) { checkValidPosition(position, positionCount); return ids[position + idsOffset]; }
protected void checkReadablePosition(int position) { checkValidPosition(position, getPositionCount()); } }
@Override protected int getPositionOffset(int position) { checkValidPosition(position, positions); return getOffset(position); }
@Override public int getSliceLength(int position) { checkValidPosition(position, positions); return getOffset((position + 1)) - getOffset(position); }
@Override public Block getPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); for (int i = offset; i < offset + length; i++) { checkValidPosition(positions[i], positionCount); } return new RunLengthEncodedBlock(value, length); }
@Override public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); for (int i = offset; i < offset + length; i++) { checkValidPosition(positions[i], positionCount); } return new RunLengthEncodedBlock(value.copyRegion(0, 1), length); }
@Override public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); SliceOutput newSlice = Slices.allocate(length * fixedSize).getOutput(); SliceOutput newValueIsNull = null; if (valueIsNull != null) { newValueIsNull = Slices.allocate(length).getOutput(); } for (int i = offset; i < offset + length; ++i) { int position = positions[i]; checkValidPosition(position, positionCount); newSlice.writeBytes(slice, position * fixedSize, fixedSize); if (valueIsNull != null) { newValueIsNull.writeByte(valueIsNull.getByte(position)); } } return new FixedWidthBlock(fixedSize, length, newSlice.slice(), newValueIsNull == null ? null : newValueIsNull.slice()); }
@Override public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); SliceOutput newSlice = Slices.allocate(length * fixedSize).getOutput(); SliceOutput newValueIsNull = null; if (hasNullValue) { newValueIsNull = Slices.allocate(length).getOutput(); } for (int i = offset; i < offset + length; ++i) { int position = positions[i]; checkValidPosition(position, positionCount); if (hasNullValue) { newValueIsNull.appendByte(valueIsNull.getUnderlyingSlice().getByte(position)); } newSlice.writeBytes(getRawSlice(), position * fixedSize, fixedSize); } return new FixedWidthBlock(fixedSize, length, newSlice.slice(), newValueIsNull == null ? null : newValueIsNull.slice()); }