Package org.apache.hadoop.hbase
Class KeyValue.KeyOnlyKeyValue
java.lang.Object
org.apache.hadoop.hbase.KeyValue
org.apache.hadoop.hbase.KeyValue.KeyOnlyKeyValue
- All Implemented Interfaces:
Cloneable,Cell,ExtendedCell,HeapSize,RawCell
- Enclosing class:
- KeyValue
A simple form of KeyValue that creates a keyvalue with only the key part of the byte[] Mainly
used in places where we need to compare two cells. Avoids copying of bytes In places like block
index keys, we need to compare the key byte[] with a cell. Hence create a Keyvalue(aka Cell)
that would help in comparing as two cells
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.KeyValue
KeyValue.KeyOnlyKeyValue, KeyValue.SamePrefixComparator<T>, KeyValue.Type -
Field Summary
FieldsFields inherited from class org.apache.hadoop.hbase.KeyValue
bytes, COLUMN_FAMILY_DELIM_ARRAY, COLUMN_FAMILY_DELIMITER, FAMILY_LENGTH_SIZE, FIXED_OVERHEAD, KEY_INFRASTRUCTURE_SIZE, KEY_LENGTH_SIZE, KEYVALUE_INFRASTRUCTURE_SIZE, KEYVALUE_WITH_TAGS_INFRASTRUCTURE_SIZE, length, LOWESTKEY, offset, ROW_KEY_OFFSET, ROW_LENGTH_SIZE, ROW_OFFSET, TAGS_LENGTH_SIZE, TIMESTAMP_SIZE, TIMESTAMP_TYPE_SIZE, TYPE_SIZEFields inherited from interface org.apache.hadoop.hbase.ExtendedCell
CELL_NOT_BASED_ON_CHUNKFields inherited from interface org.apache.hadoop.hbase.RawCell
MAX_TAGS_LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleanNeeded doing 'contains' on List.byte[]Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)byteReturns Family length(package private) intgetFamilyLengthPosition(int rowLength) intReturns Family offsetbyte[]getKey()Do not use unless you have to.intReturns Length of key portion.intReturns Key offset in backing buffer..byte[]Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)intReturns Qualifier lengthprivate intgetQualifierLength(int rlength, int flength) intReturns Qualifier offsetbyte[]Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)shortReturns Row lengthintReturns Row offsetbyte[]Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)intReturn the total length of the tag bytesintReturn the offset where the tag data starts.longReturn the timestamp.intReturns Timestamp offsetbyteReturns KeyValue.TYPE byte representation(package private) bytegetTypeByte(int keyLength) Return the KeyValue.TYPE byte representationbyte[]Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)intReturns Value lengthintReturns the value offsetinthashCode()In line withKeyValue.equals(Object), only uses the key portion, not the value.longheapSize()HeapSize implementationvoidset(KeyValue.KeyOnlyKeyValue keyOnlyKeyValue) voidsetKey(byte[] key, int offset, int length) A setter that helps to avoid object creation every time and whenever there is a need to create new KeyOnlyKeyValue.toString()intwrite(OutputStream out, boolean withTags) Write this cell to an OutputStream in aKeyValueformat.Methods inherited from class org.apache.hadoop.hbase.KeyValue
checkParameters, clone, create, create, createKeyOnly, deepClone, getBuffer, getDelimiter, getDelimiterInReverse, getFamilyLength, getFamilyOffset, getKeyDataStructureSize, getKeyString, getKeyValueDataStructureSize, getKeyValueDataStructureSize, getKeyValueDataStructureSize, getLength, getOffset, getQualifierLength, getQualifierOffset, getSequenceId, getSerializedSize, getSerializedSize, getTimestamp, humanReadableTimestamp, isLatestTimestamp, keyToString, keyToString, setSequenceId, setTimestamp, setTimestamp, shallowCopy, toStringMap, updateLatestStamp, write, write, writeByteArrayMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.ExtendedCell
getChunkId, getType
-
Field Details
-
rowLen
-
-
Constructor Details
-
KeyOnlyKeyValue
public KeyOnlyKeyValue() -
KeyOnlyKeyValue
-
KeyOnlyKeyValue
-
-
Method Details
-
set
-
clear
-
getKeyOffset
Description copied from class:KeyValueReturns Key offset in backing buffer..- Overrides:
getKeyOffsetin classKeyValue
-
setKey
A setter that helps to avoid object creation every time and whenever there is a need to create new KeyOnlyKeyValue.- Parameters:
key- Key to setoffset- Offset of the Keylength- length of the Key
-
getKey
Description copied from class:KeyValueDo not use unless you have to. Used internally for compacting and testing. UseKeyValue.getRowArray(),KeyValue.getFamilyArray(),KeyValue.getQualifierArray(), andKeyValue.getValueArray()if accessing a KeyValue client-side. -
getRowArray
Description copied from class:KeyValueReturns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getRowArrayin interfaceCell- Overrides:
getRowArrayin classKeyValue- Returns:
- The array containing the row bytes.
-
getRowOffset
Description copied from class:KeyValueReturns Row offset- Specified by:
getRowOffsetin interfaceCell- Overrides:
getRowOffsetin classKeyValue
-
getFamilyArray
Description copied from class:KeyValueReturns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getFamilyArrayin interfaceCell- Overrides:
getFamilyArrayin classKeyValue- Returns:
- the array containing the family bytes.
-
getFamilyLength
Description copied from class:KeyValueReturns Family length- Specified by:
getFamilyLengthin interfaceCell- Overrides:
getFamilyLengthin classKeyValue
-
getFamilyLengthPosition
- Overrides:
getFamilyLengthPositionin classKeyValue
-
getFamilyOffset
Description copied from class:KeyValueReturns Family offset- Specified by:
getFamilyOffsetin interfaceCell- Overrides:
getFamilyOffsetin classKeyValue
-
getQualifierArray
Description copied from class:KeyValueReturns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getQualifierArrayin interfaceCell- Overrides:
getQualifierArrayin classKeyValue- Returns:
- The array containing the qualifier bytes.
-
getQualifierLength
Description copied from class:KeyValueReturns Qualifier length- Specified by:
getQualifierLengthin interfaceCell- Overrides:
getQualifierLengthin classKeyValue
-
getQualifierOffset
Description copied from class:KeyValueReturns Qualifier offset- Specified by:
getQualifierOffsetin interfaceCell- Overrides:
getQualifierOffsetin classKeyValue
-
getKeyLength
Description copied from class:KeyValueReturns Length of key portion.- Overrides:
getKeyLengthin classKeyValue
-
getRowLength
Description copied from class:KeyValueReturns Row length- Specified by:
getRowLengthin interfaceCell- Overrides:
getRowLengthin classKeyValue
-
getTypeByte
Description copied from class:KeyValueReturns KeyValue.TYPE byte representation- Specified by:
getTypeBytein interfaceExtendedCell- Overrides:
getTypeBytein classKeyValue
-
getTypeByte
Description copied from class:KeyValueReturn the KeyValue.TYPE byte representation- Overrides:
getTypeBytein classKeyValue
-
getQualifierLength
-
getTimestamp
Description copied from class:KeyValueReturn the timestamp.- Specified by:
getTimestampin interfaceCell- Overrides:
getTimestampin classKeyValue
-
getTimestampOffset
Description copied from class:KeyValueReturns Timestamp offset- Overrides:
getTimestampOffsetin classKeyValue
-
getTagsArray
Description copied from class:KeyValueReturns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getTagsArrayin interfaceRawCell- Overrides:
getTagsArrayin classKeyValue- Returns:
- the tags byte array
-
getTagsOffset
Description copied from class:KeyValueReturn the offset where the tag data starts.- Specified by:
getTagsOffsetin interfaceRawCell- Overrides:
getTagsOffsetin classKeyValue
-
getValueArray
Description copied from class:KeyValueReturns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getValueArrayin interfaceCell- Overrides:
getValueArrayin classKeyValue- Returns:
- The array containing the value bytes.
-
getValueOffset
Description copied from class:KeyValueReturns the value offset- Specified by:
getValueOffsetin interfaceCell- Overrides:
getValueOffsetin classKeyValue
-
getValueLength
Description copied from class:KeyValueReturns Value length- Specified by:
getValueLengthin interfaceCell- Overrides:
getValueLengthin classKeyValue
-
getTagsLength
Description copied from class:KeyValueReturn the total length of the tag bytes- Specified by:
getTagsLengthin interfaceRawCell- Overrides:
getTagsLengthin classKeyValue- Returns:
- the total length of the tags in the Cell.
-
toString
-
hashCode
Description copied from class:KeyValueIn line withKeyValue.equals(Object), only uses the key portion, not the value. -
equals
Description copied from class:KeyValueNeeded doing 'contains' on List. Only compares the key portion, not the value. -
heapSize
Description copied from class:KeyValueHeapSize implementation We do not count the bytes in the rowCache because it should be empty for a KeyValue in the MemStore. -
write
Description copied from interface:ExtendedCellWrite this cell to an OutputStream in aKeyValueformat.
KeyValue format
<4 bytes keylength> <4 bytes valuelength> <2 bytes rowlength> <row> <1 byte columnfamilylength> <columnfamily> <columnqualifier> <8 bytes timestamp> <1 byte keytype> <value> <2 bytes tagslength> <tags>- Specified by:
writein interfaceExtendedCell- Overrides:
writein classKeyValue- Parameters:
out- Stream to which cell has to be writtenwithTags- Whether to write tags.- Returns:
- how many bytes are written.
- Throws:
IOException
-