@Override protected Slice getRawSlice(int position) { return sliceOutput.getUnderlyingSlice(); }
@Override protected Slice getRawSlice() { return sliceOutput.getUnderlyingSlice(); }
@Override protected boolean isEntryNull(int position) { return valueIsNull.getUnderlyingSlice().getByte(position) != 0; }
@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 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); }
public Slice serialize() { compact(); int requiredBytes = SizeOf.SIZE_OF_BYTE + // format SizeOf.SIZE_OF_INT + // max buckets SizeOf.SIZE_OF_INT + // entry count SizeOf.SIZE_OF_DOUBLE * nextIndex + // values SizeOf.SIZE_OF_DOUBLE * nextIndex; // weights return Slices.allocate(requiredBytes) .getOutput() .appendByte(FORMAT_TAG) .appendInt(maxBuckets) .appendInt(nextIndex) .appendBytes(Slices.wrappedDoubleArray(values, 0, nextIndex)) .appendBytes(Slices.wrappedDoubleArray(weights, 0, nextIndex)) .getUnderlyingSlice(); }
@Override public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); int finalLength = 0; for (int i = offset; i < offset + length; i++) { finalLength += getSliceLength(positions[i]); } SliceOutput newSlice = Slices.allocate(finalLength).getOutput(); int[] newOffsets = new int[length + 1]; boolean[] newValueIsNull = null; if (hasNullValue) { newValueIsNull = new boolean[length]; } for (int i = 0; i < length; i++) { int position = positions[offset + i]; if (isEntryNull(position)) { newValueIsNull[i] = true; } else { newSlice.writeBytes(sliceOutput.getUnderlyingSlice(), getPositionOffset(position), getSliceLength(position)); } newOffsets[i + 1] = newSlice.size(); } return new VariableWidthBlock(0, length, newSlice.slice(), newOffsets, newValueIsNull); }
@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()); }
@Override protected Slice getRawSlice() { return sliceOutput.getUnderlyingSlice(); }
@Override protected Slice getRawSlice(int position) { return sliceOutput.getUnderlyingSlice(); }
@Override protected Slice getRawSlice() { return sliceOutput.getUnderlyingSlice(); }
@Override protected Slice getRawSlice(int position) { return sliceOutput.getUnderlyingSlice(); }
@Override protected boolean isEntryNull(int position) { return valueIsNull.getUnderlyingSlice().getByte(position) != 0; }
@Override protected boolean isEntryNull(int position) { return valueIsNull.getUnderlyingSlice().getByte(position) != 0; }
@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 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 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 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); }
public Slice serialize() { compact(); int requiredBytes = SizeOf.SIZE_OF_BYTE + // format SizeOf.SIZE_OF_INT + // max buckets SizeOf.SIZE_OF_INT + // entry count SizeOf.SIZE_OF_DOUBLE * nextIndex + // values SizeOf.SIZE_OF_DOUBLE * nextIndex; // weights return Slices.allocate(requiredBytes) .getOutput() .appendByte(FORMAT_TAG) .appendInt(maxBuckets) .appendInt(nextIndex) .appendBytes(Slices.wrappedDoubleArray(values, 0, nextIndex)) .appendBytes(Slices.wrappedDoubleArray(weights, 0, nextIndex)) .getUnderlyingSlice(); }
public Slice serialize() { compact(); int requiredBytes = SizeOf.SIZE_OF_BYTE + // format SizeOf.SIZE_OF_INT + // max buckets SizeOf.SIZE_OF_INT + // entry count SizeOf.SIZE_OF_DOUBLE * nextIndex + // values SizeOf.SIZE_OF_DOUBLE * nextIndex; // weights return Slices.allocate(requiredBytes) .getOutput() .appendByte(FORMAT_TAG) .appendInt(maxBuckets) .appendInt(nextIndex) .appendBytes(Slices.wrappedDoubleArray(values, 0, nextIndex)) .appendBytes(Slices.wrappedDoubleArray(weights, 0, nextIndex)) .getUnderlyingSlice(); }