Class PrefixKeyDeltaEncoder
java.lang.Object
org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
org.apache.hadoop.hbase.io.encoding.BufferedDataBlockEncoder
org.apache.hadoop.hbase.io.encoding.PrefixKeyDeltaEncoder
- All Implemented Interfaces:
DataBlockEncoder
Compress key by storing size of common prefix with previous KeyValue and storing raw size of
rest. Format: 1-5 bytes: compressed key length minus prefix (7-bit encoding) 1-5 bytes:
compressed value length (7-bit encoding) 1-3 bytes: compressed length of common key prefix ...
bytes: rest of key (including timestamp) ... bytes: value In a worst case compressed KeyValue
will be three bytes longer than original.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classNested classes/interfaces inherited from class org.apache.hadoop.hbase.io.encoding.BufferedDataBlockEncoder
BufferedDataBlockEncoder.BufferedEncodedSeeker<STATE extends BufferedDataBlockEncoder.SeekerState>, BufferedDataBlockEncoder.OffheapDecodedExtendedCell, BufferedDataBlockEncoder.OnheapDecodedCell, BufferedDataBlockEncoder.SeekerStateNested classes/interfaces inherited from class org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
AbstractDataBlockEncoder.AbstractEncodedSeekerNested classes/interfaces inherited from interface org.apache.hadoop.hbase.io.encoding.DataBlockEncoder
DataBlockEncoder.EncodedSeeker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateSeeker(HFileBlockDecodingContext decodingCtx) Create a HFileBlock seeker which find KeyValues within a block.private intdecodeKeyValue(DataInputStream source, ByteBuffer buffer, int prevKeyOffset) getFirstKeyCellInBlock(ByteBuff block) Return first key in block as a cell.protected ByteBufferinternalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) intinternalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) toString()private voidwriteKeyExcludingCommon(Cell cell, int commonPrefix, DataOutputStream out) Methods inherited from class org.apache.hadoop.hbase.io.encoding.BufferedDataBlockEncoder
afterDecodingKeyValue, afterEncodingKeyValue, compareCommonFamilyPrefix, compareCommonQualifierPrefix, compareCommonRowPrefix, decodeKeyValues, encode, endBlockEncoding, ensureSpace, startBlockEncodingMethods inherited from class org.apache.hadoop.hbase.io.encoding.AbstractDataBlockEncoder
createFirstKeyCell, newDataBlockDecodingContext, newDataBlockEncodingContext, postEncoding
-
Constructor Details
-
PrefixKeyDeltaEncoder
public PrefixKeyDeltaEncoder()
-
-
Method Details
-
internalEncode
public int internalEncode(Cell cell, HFileBlockDefaultEncodingContext encodingContext, DataOutputStream out) throws IOException - Specified by:
internalEncodein classBufferedDataBlockEncoder- Throws:
IOException
-
writeKeyExcludingCommon
private void writeKeyExcludingCommon(Cell cell, int commonPrefix, DataOutputStream out) throws IOException - Throws:
IOException
-
internalDecodeKeyValues
protected ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength, int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException - Specified by:
internalDecodeKeyValuesin classBufferedDataBlockEncoder- Throws:
IOException
-
decodeKeyValue
private int decodeKeyValue(DataInputStream source, ByteBuffer buffer, int prevKeyOffset) throws IOException, EncoderBufferTooSmallException -
getFirstKeyCellInBlock
Description copied from interface:DataBlockEncoderReturn first key in block as a cell. Useful for indexing. Typically does not make a deep copy but returns a buffer wrapping a segment of the actual block's byte array. This is because the first key in block is usually stored unencoded.- Parameters:
block- encoded block we want index, the position will not change- Returns:
- First key in block as a cell.
-
toString
-
createSeeker
Description copied from interface:DataBlockEncoderCreate a HFileBlock seeker which find KeyValues within a block.- Returns:
- A newly created seeker.
-