@Override protected ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException { int decompressedSize = source.readInt(); ByteBuffer buffer = ByteBuffer.allocate(decompressedSize + allocateHeaderLength); buffer.position(allocateHeaderLength); FastDiffCompressionState state = new FastDiffCompressionState(); while (source.available() > skipLastBytes) { uncompressSingleKeyValue(source, buffer, state); afterDecodingKeyValue(source, buffer, decodingCtx); } if (source.available() != skipLastBytes) { throw new IllegalStateException("Read too much bytes."); } return buffer; }
@Override public int internalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) throws IOException { EncodingState state = encodingContext.getEncodingState(); int size = compressSingleKeyValue(out, cell, state.prevCell); size += afterEncodingKeyValue(cell, out, encodingContext); state.prevCell = cell; return size; }
ensureSpace(out, state.keyLength + state.valueLength + KeyValue.ROW_OFFSET);
int commonTimestampPrefix = findCommonTimestampPrefix(curTsBuf, Bytes.toBytes(prevCell.getTimestamp()));
@Override public Cell getFirstKeyCellInBlock(ByteBuff block) { block.mark(); block.position(Bytes.SIZEOF_INT + Bytes.SIZEOF_BYTE); int keyLength = ByteBuff.readCompressedInt(block); // TODO : See if we can avoid these reads as the read values are not getting used ByteBuff.readCompressedInt(block); // valueLength ByteBuff.readCompressedInt(block); // commonLength ByteBuffer key = block.asSubByteBuffer(keyLength).duplicate(); block.reset(); return createFirstKeyCell(key, keyLength); }
int commonTimestampPrefix = findCommonTimestampPrefix( currentState, previousState); flag |= commonTimestampPrefix << SHIFT_TIMESTAMP_LENGTH;
@Override public Cell getFirstKeyCellInBlock(ByteBuff block) { block.mark(); block.position(Bytes.SIZEOF_INT + Bytes.SIZEOF_BYTE); int keyLength = ByteBuff.readCompressedInt(block); // TODO : See if we can avoid these reads as the read values are not getting used ByteBuff.readCompressedInt(block); // valueLength ByteBuff.readCompressedInt(block); // commonLength ByteBuffer key = block.asSubByteBuffer(keyLength).duplicate(); block.reset(); return createFirstKeyCell(key, keyLength); }
@Override public int internalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) throws IOException { EncodingState state = encodingContext.getEncodingState(); int size = compressSingleKeyValue(out, cell, state.prevCell); size += afterEncodingKeyValue(cell, out, encodingContext); state.prevCell = cell; return size; }
@Override protected ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException { int decompressedSize = source.readInt(); ByteBuffer buffer = ByteBuffer.allocate(decompressedSize + allocateHeaderLength); buffer.position(allocateHeaderLength); FastDiffCompressionState state = new FastDiffCompressionState(); while (source.available() > skipLastBytes) { uncompressSingleKeyValue(source, buffer, state); afterDecodingKeyValue(source, buffer, decodingCtx); } if (source.available() != skipLastBytes) { throw new IllegalStateException("Read too much bytes."); } return buffer; }
int commonTimestampPrefix = findCommonTimestampPrefix(curTsBuf, Bytes.toBytes(prevCell.getTimestamp()));
ensureSpace(out, state.keyLength + state.valueLength + KeyValue.ROW_OFFSET);
@Override public Cell getFirstKeyCellInBlock(ByteBuff block) { block.mark(); block.position(Bytes.SIZEOF_INT + Bytes.SIZEOF_BYTE); int keyLength = ByteBuff.readCompressedInt(block); // TODO : See if we can avoid these reads as the read values are not getting used ByteBuff.readCompressedInt(block); // valueLength ByteBuff.readCompressedInt(block); // commonLength ByteBuffer key = block.asSubByteBuffer(keyLength).duplicate(); block.reset(); return createFirstKeyCell(key, keyLength); }
@Override public int internalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) throws IOException { EncodingState state = encodingContext.getEncodingState(); int size = compressSingleKeyValue(out, cell, state.prevCell); size += afterEncodingKeyValue(cell, out, encodingContext); state.prevCell = cell; return size; }
@Override protected ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException { int decompressedSize = source.readInt(); ByteBuffer buffer = ByteBuffer.allocate(decompressedSize + allocateHeaderLength); buffer.position(allocateHeaderLength); FastDiffCompressionState state = new FastDiffCompressionState(); while (source.available() > skipLastBytes) { uncompressSingleKeyValue(source, buffer, state); afterDecodingKeyValue(source, buffer, decodingCtx); } if (source.available() != skipLastBytes) { throw new IllegalStateException("Read too much bytes."); } return buffer; }
int commonTimestampPrefix = findCommonTimestampPrefix(curTsBuf, Bytes.toBytes(prevCell.getTimestamp()));
ensureSpace(out, state.keyLength + state.valueLength + KeyValue.ROW_OFFSET);
@Override public int internalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) throws IOException { EncodingState state = encodingContext.getEncodingState(); int size = compressSingleKeyValue(out, cell, state.prevCell); size += afterEncodingKeyValue(cell, out, encodingContext); state.prevCell = cell; return size; }
@Override public ByteBuffer uncompressKeyValues(DataInputStream source, int allocHeaderLength, int skipLastBytes, boolean includesMemstoreTS) throws IOException { int decompressedSize = source.readInt(); ByteBuffer buffer = ByteBuffer.allocate(decompressedSize + allocHeaderLength); buffer.position(allocHeaderLength); FastDiffCompressionState state = new FastDiffCompressionState(); while (source.available() > skipLastBytes) { uncompressSingleKeyValue(source, buffer, state); afterDecodingKeyValue(source, buffer, includesMemstoreTS); } if (source.available() != skipLastBytes) { throw new IllegalStateException("Read too much bytes."); } return buffer; }
int commonTimestampPrefix = findCommonTimestampPrefix(curTsBuf, Bytes.toBytes(prevCell.getTimestamp()));
ensureSpace(out, state.keyLength + state.valueLength + KeyValue.ROW_OFFSET);