/** * Initializes the internal state for decoding ints of `bitWidth`. */ private void init(int bitWidth) { Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth); this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); }
/** * @param bitWidth the number of bits used to encode an int * @param packer factory for bit packing implementations */ public ByteBasedBitPackingEncoder(int bitWidth, Packer packer) { this.bitWidth = bitWidth; this.inputSize = 0; this.totalFullSlabSize = 0; // must be a multiple of bitWidth this.slabSize = (bitWidth == 0) ? 1 : (bitWidth * INITIAL_SLAB_SIZE_MULT); initPackedSlab(); this.packer = packer.newBytePacker(bitWidth); }
int valueIndex = 0; for (int byteIndex = offset; valueIndex < this.currentCount; byteIndex += this.bitWidth) { this.packer.unpack8Values(in, byteIndex, this.currentBuffer, valueIndex); valueIndex += 8;
private void pack() { packer.pack8Values(input, 0, packed, packedPosition); packedPosition += bitWidth; totalValues += inputSize; inputSize = 0; }
@Override public BytePacker newBytePacker(int width) { return beBytePackerFactory.newBytePacker(width); } @Override
@Override public void finish() throws IOException { if (count != 0) { int numberOfBits = count * 6; finish(numberOfBits, buffer, out); buffer = 0; count = 0; } // check this does not impede perf out = null; }
@Override public BytePackerForLong newBytePackerForLong(int width) { return leBytePackerForLongFactory.newBytePackerForLong(width); } };
@Override public void finish() throws IOException { if (count != 0) { int numberOfBits = count * 5; finish(numberOfBits, buffer, out); buffer = 0; count = 0; } // check this does not impede perf out = null; }
@Override public IntPacker newIntPacker(int width) { return leIntPackerFactory.newIntPacker(width); } @Override
/** * {@inheritDoc} * @see org.apache.parquet.column.values.ValuesReader#skip() */ @Override public void skip() { in.readInteger(); }
@Override public void finish() throws IOException { while (count != 0) { write(0); } // check this does not impede perf out = null; }
/** * Initializes the internal state for decoding ints of `bitWidth`. */ private void init(int bitWidth) { Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth); this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); }
this.packer.unpack8Values(buffer, buffer.position(), this.currentBuffer, valueIndex); valueIndex += 8;
/** * @param bitWidth the number of bits used to encode an int * @param packer factory for bit packing implementations */ public ByteBasedBitPackingEncoder(int bitWidth, Packer packer) { this.bitWidth = bitWidth; this.inputSize = 0; this.totalFullSlabSize = 0; // must be a multiple of bitWidth this.slabSize = (bitWidth == 0) ? 1 : (bitWidth * INITIAL_SLAB_SIZE_MULT); initPackedSlab(); this.packer = packer.newBytePacker(bitWidth); }
@Override public BytePacker newBytePacker(int width) { return leBytePackerFactory.newBytePacker(width); } @Override
@Override public void finish() throws IOException { if (count != 0) { int numberOfBits = count * 6; finish(numberOfBits, buffer, out); buffer = 0; count = 0; } // check this does not impede perf out = null; }
@Override public BytePackerForLong newBytePackerForLong(int width) { return leBytePackerForLongFactory.newBytePackerForLong(width); } };
/** * Initializes the internal state for decoding ints of `bitWidth`. */ private void init(int bitWidth) { Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32"); this.bitWidth = bitWidth; this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth); this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth); }
this.packer.unpack8Values(buffer, buffer.position(), this.currentBuffer, valueIndex); valueIndex += 8;
@Override public BytePacker newBytePacker(int width) { return leBytePackerFactory.newBytePacker(width); } @Override