@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(positionCount, positionOffset, length); Slice newSlice = compactSlice(slice, positionOffset * fixedSize, length * fixedSize); Slice newValueIsNull = null; if (valueIsNull != null) { newValueIsNull = compactSlice(valueIsNull, positionOffset, length); } if (newSlice == slice && newValueIsNull == valueIsNull) { return this; } return new FixedWidthBlock(fixedSize, length, newSlice, newValueIsNull); }
@Override public Block copyRegion(int positionOffset, int length) { checkValidRegion(getPositionCount(), positionOffset, length); positionOffset += arrayOffset; int[] newOffsets = compactOffsets(offsets, positionOffset, length); Slice newSlice = compactSlice(slice, offsets[positionOffset], newOffsets[length]); boolean[] newValueIsNull = valueIsNull == null ? null : compactArray(valueIsNull, positionOffset, length); if (newOffsets == offsets && newSlice == slice && newValueIsNull == valueIsNull) { return this; } return new VariableWidthBlock(0, length, newSlice, newOffsets, newValueIsNull); }
@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); }