@Override public long getRegionSizeInBytes(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); return (fixedSize + Byte.BYTES) * (long) length; }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(positionCount, positionOffset, length); return new DictionaryBlock(idsOffset + positionOffset, length, dictionary, ids, false, dictionarySourceId); }
@Override public Block copyRegion(int position, int length) { checkValidRegion(positionCount, position, length); int[] newIds = Arrays.copyOfRange(ids, idsOffset + position, idsOffset + position + length); DictionaryBlock dictionaryBlock = new DictionaryBlock(dictionary, newIds); return dictionaryBlock.compact(); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); return new ShortArrayBlock(positionOffset + arrayOffset, length, valueIsNull, values); }
@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(positionCount, positionOffset, length); return new RunLengthEncodedBlock(value.copyRegion(0, 1), length); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); return new LongArrayBlock(positionOffset + arrayOffset, length, valueIsNull, values); }
@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) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } return new ByteArrayBlock(positionOffset, length, hasNullValue ? valueIsNull : null, values); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } return new ShortArrayBlock(positionOffset, length, hasNullValue ? valueIsNull : null, values); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } return new LongArrayBlock(positionOffset, length, hasNullValue ? valueIsNull : null, values); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(positionCount, positionOffset, length); Slice newSlice = slice.slice(positionOffset * fixedSize, length * fixedSize); Slice newValueIsNull = null; if (valueIsNull != null) { newValueIsNull = valueIsNull.slice(positionOffset, length); } return new FixedWidthBlock(fixedSize, length, newSlice, newValueIsNull); }
@Override public Block getRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); if (!hasNonNullValue) { return new RunLengthEncodedBlock(NULL_VALUE_BLOCK, length); } return new IntArrayBlock(positionOffset, length, hasNullValue ? valueIsNull : null, values); }
@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); positionOffset += arrayOffset; boolean[] newValueIsNull = valueIsNull == null ? null : compactArray(valueIsNull, positionOffset, length); short[] newValues = compactArray(values, positionOffset, length); if (newValueIsNull == valueIsNull && newValues == values) { return this; } return new ShortArrayBlock(0, length, newValueIsNull, newValues); }
@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); positionOffset += arrayOffset; boolean[] newValueIsNull = valueIsNull == null ? null : compactArray(valueIsNull, positionOffset, length); byte[] newValues = compactArray(values, positionOffset, length); if (newValueIsNull == valueIsNull && newValues == values) { return this; } return new ByteArrayBlock(0, length, newValueIsNull, newValues); }
@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); positionOffset += arrayOffset; boolean[] newValueIsNull = valueIsNull == null ? null : compactArray(valueIsNull, positionOffset, length); long[] newValues = compactArray(values, positionOffset, length); if (newValueIsNull == valueIsNull && newValues == values) { return this; } return new LongArrayBlock(0, length, newValueIsNull, newValues); }
@Override public Block getRegion(int position, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, position, length); return createArrayBlockInternal( position + getOffsetBase(), length, getValueIsNull(), getOffsets(), getRawElementBlock()); }
@Override public Block getRegion(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); Slice newSlice = sliceOutput.slice().slice(positionOffset * fixedSize, length * fixedSize); Slice newValueIsNull = null; if (hasNullValue) { newValueIsNull = valueIsNull.slice().slice(positionOffset, length); } return new FixedWidthBlock(fixedSize, length, newSlice, newValueIsNull); }
@Override public Block copyRegion(int positionOffset, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, positionOffset, length); Slice newSlice = Slices.copyOf(sliceOutput.getUnderlyingSlice(), positionOffset * fixedSize, length * fixedSize); Slice newValueIsNull = null; if (hasNullValue) { newValueIsNull = Slices.copyOf(valueIsNull.getUnderlyingSlice(), positionOffset, length); } return new FixedWidthBlock(fixedSize, length, newSlice, newValueIsNull); }
@Override public Block getRegion(int position, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, position, length); return createRowBlockInternal(position + getOffsetBase(), length, getRowIsNull(), getFieldBlockOffsets(), getRawFieldBlocks()); }
@Override public long getRegionSizeInBytes(int position, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, position, length); int valueStart = getOffsets()[getOffsetBase() + position]; int valueEnd = getOffsets()[getOffsetBase() + position + length]; return getRawElementBlock().getRegionSizeInBytes(valueStart, valueEnd - valueStart) + ((Integer.BYTES + Byte.BYTES) * (long) length); }