@Override public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { makeDelegate(); delegate.writeTo(channel, smoosher); } }
@Override public ColumnarMultiInts get() { return new CompressedVSizeColumnarMultiIntsSupplier.CompressedVSizeColumnarMultiInts( offsetSupplier.get(), valueSupplier.get() ); }
@Override public long getSerializedSize() throws IOException { writeLastOffset(); return 1 + offsetWriter.getSerializedSize() + valueWriter.getSerializedSize(); }
public BlockLayoutColumnarDoublesSupplier( int totalSize, int sizePer, ByteBuffer fromBuffer, ByteOrder byteOrder, CompressionStrategy strategy ) { baseDoubleBuffers = GenericIndexed.read(fromBuffer, new DecompressingByteBufferObjectStrategy(byteOrder, strategy)); this.totalSize = totalSize; this.sizePer = sizePer; }
@Override public ColumnarMultiInts get() { return new CompressedVSizeColumnarMultiInts(offsetSupplier.get(), valueSupplier.get()); }
@Override public long getSerializedSize() { return 1 + offsetSupplier.getSerializedSize() + valueSupplier.getSerializedSize(); }
public static VSizeColumnarInts fromArray(int[] array, int maxValue) { return fromIndexedInts(new ArrayBasedIndexedInts(array), maxValue); }
public static int maxIntsInBufferForValue(int maxValue) { return maxIntsInBufferForBytes(VSizeColumnarInts.getNumBytesForMax(maxValue)); }
@Override public long getSerializedSize() throws IOException { makeDelegate(); return delegate.getSerializedSize(); }
static GenericIndexed<ResourceHolder<ByteBuffer>> ofCompressedByteBuffers( Iterable<ByteBuffer> buffers, CompressionStrategy compression, int bufferSize, ByteOrder order, Closer closer ) { return fromIterableVersionOne( buffers, GenericIndexedWriter.compressedByteBuffersWriteObjectStrategy(compression, bufferSize, closer), false, new DecompressingByteBufferObjectStrategy(order, compression) ); }
@Override public void putMeta(ByteBuffer metaOut, CompressionStrategy strategy) { metaOut.put(CompressionFactory.setEncodingFlag(strategy.getId())); metaOut.put(CompressionFactory.LongEncodingFormat.DELTA.getId()); metaOut.put(CompressionFactory.DELTA_ENCODING_VERSION); metaOut.putLong(base); metaOut.putInt(bitsPerValue); }
@Override public long get(int index) { // division + remainder is optimized by the compiler so keep those together final int bufferNum = index / sizePer; final int bufferIndex = index % sizePer; if (bufferNum != currBufferNum) { loadBuffer(bufferNum); } return reader.read(bufferIndex); }
public VSizeColumnarMultiIntsSerializer(SegmentWriteOutMedium segmentWriteOutMedium, int maxId) { this.segmentWriteOutMedium = segmentWriteOutMedium; this.maxId = maxId; this.writeInt = WriteInt.values()[VSizeColumnarInts.getNumBytesForMax(maxId) - 1]; }
@Override public long get(int index) { // optimize division and remainder for powers of 2 final int bufferNum = index >> div; if (bufferNum != currBufferNum) { loadBuffer(bufferNum); } final int bufferIndex = index & rem; return reader.read(bufferIndex); } };
private static int sizePer(int maxValue, int chunkFactor) { return chunkFactor * VSizeColumnarInts.getNumBytesForMax(maxValue) + CompressedVSizeColumnarIntsSupplier.bufferPadding(VSizeColumnarInts.getNumBytesForMax(maxValue)); }
public static ColumnarFloatsSerializer getFloatSerializer( SegmentWriteOutMedium segmentWriteOutMedium, String filenameBase, ByteOrder order, CompressionStrategy compressionStrategy ) { if (compressionStrategy == CompressionStrategy.NONE) { return new EntireLayoutColumnarFloatsSerializer(segmentWriteOutMedium, order); } else { return new BlockLayoutColumnarFloatsSerializer(segmentWriteOutMedium, filenameBase, order, compressionStrategy); } }
public BlockLayoutColumnarFloatsSupplier( int totalSize, int sizePer, ByteBuffer fromBuffer, ByteOrder byteOrder, CompressionStrategy strategy ) { baseFloatBuffers = GenericIndexed.read(fromBuffer, new DecompressingByteBufferObjectStrategy(byteOrder, strategy)); this.totalSize = totalSize; this.sizePer = sizePer; }