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
Fields 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_SIZE
Fields inherited from interface org.apache.hadoop.hbase.ExtendedCell
CELL_NOT_BASED_ON_CHUNK
Fields inherited from interface org.apache.hadoop.hbase.RawCell
MAX_TAGS_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
Needed doing 'contains' on List.byte[]
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)byte
Returns Family length(package private) int
getFamilyLengthPosition
(int rowLength) int
Returns Family offsetbyte[]
getKey()
Do not use unless you have to.int
Returns Length of key portion.int
Returns Key offset in backing buffer..byte[]
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)int
Returns Qualifier lengthprivate int
getQualifierLength
(int rlength, int flength) int
Returns Qualifier offsetbyte[]
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)short
Returns Row lengthint
Returns Row offsetbyte[]
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)int
Return the total length of the tag bytesint
Return the offset where the tag data starts.long
Return the timestamp.int
Returns Timestamp offsetbyte
Returns KeyValue.TYPE byte representation(package private) byte
getTypeByte
(int keyLength) Return the KeyValue.TYPE byte representationbyte[]
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)int
Returns Value lengthint
Returns the value offsetint
hashCode()
In line withKeyValue.equals(Object)
, only uses the key portion, not the value.long
heapSize()
HeapSize implementationvoid
set
(KeyValue.KeyOnlyKeyValue keyOnlyKeyValue) void
setKey
(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()
int
write
(OutputStream out, boolean withTags) Write this cell to an OutputStream in aKeyValue
format.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, writeByteArray
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:KeyValue
Returns Key offset in backing buffer..- Overrides:
getKeyOffset
in 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:KeyValue
Do 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:KeyValue
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getRowArray
in interfaceCell
- Overrides:
getRowArray
in classKeyValue
- Returns:
- The array containing the row bytes.
-
getRowOffset
Description copied from class:KeyValue
Returns Row offset- Specified by:
getRowOffset
in interfaceCell
- Overrides:
getRowOffset
in classKeyValue
-
getFamilyArray
Description copied from class:KeyValue
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getFamilyArray
in interfaceCell
- Overrides:
getFamilyArray
in classKeyValue
- Returns:
- the array containing the family bytes.
-
getFamilyLength
Description copied from class:KeyValue
Returns Family length- Specified by:
getFamilyLength
in interfaceCell
- Overrides:
getFamilyLength
in classKeyValue
-
getFamilyLengthPosition
- Overrides:
getFamilyLengthPosition
in classKeyValue
-
getFamilyOffset
Description copied from class:KeyValue
Returns Family offset- Specified by:
getFamilyOffset
in interfaceCell
- Overrides:
getFamilyOffset
in classKeyValue
-
getQualifierArray
Description copied from class:KeyValue
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getQualifierArray
in interfaceCell
- Overrides:
getQualifierArray
in classKeyValue
- Returns:
- The array containing the qualifier bytes.
-
getQualifierLength
Description copied from class:KeyValue
Returns Qualifier length- Specified by:
getQualifierLength
in interfaceCell
- Overrides:
getQualifierLength
in classKeyValue
-
getQualifierOffset
Description copied from class:KeyValue
Returns Qualifier offset- Specified by:
getQualifierOffset
in interfaceCell
- Overrides:
getQualifierOffset
in classKeyValue
-
getKeyLength
Description copied from class:KeyValue
Returns Length of key portion.- Overrides:
getKeyLength
in classKeyValue
-
getRowLength
Description copied from class:KeyValue
Returns Row length- Specified by:
getRowLength
in interfaceCell
- Overrides:
getRowLength
in classKeyValue
-
getTypeByte
Description copied from class:KeyValue
Returns KeyValue.TYPE byte representation- Specified by:
getTypeByte
in interfaceExtendedCell
- Overrides:
getTypeByte
in classKeyValue
-
getTypeByte
Description copied from class:KeyValue
Return the KeyValue.TYPE byte representation- Overrides:
getTypeByte
in classKeyValue
-
getQualifierLength
-
getTimestamp
Description copied from class:KeyValue
Return the timestamp.- Specified by:
getTimestamp
in interfaceCell
- Overrides:
getTimestamp
in classKeyValue
-
getTimestampOffset
Description copied from class:KeyValue
Returns Timestamp offset- Overrides:
getTimestampOffset
in classKeyValue
-
getTagsArray
Description copied from class:KeyValue
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getTagsArray
in interfaceRawCell
- Overrides:
getTagsArray
in classKeyValue
- Returns:
- the tags byte array
-
getTagsOffset
Description copied from class:KeyValue
Return the offset where the tag data starts.- Specified by:
getTagsOffset
in interfaceRawCell
- Overrides:
getTagsOffset
in classKeyValue
-
getValueArray
Description copied from class:KeyValue
Returns the backing array of the entire KeyValue (all KeyValue fields are in a single array)- Specified by:
getValueArray
in interfaceCell
- Overrides:
getValueArray
in classKeyValue
- Returns:
- The array containing the value bytes.
-
getValueOffset
Description copied from class:KeyValue
Returns the value offset- Specified by:
getValueOffset
in interfaceCell
- Overrides:
getValueOffset
in classKeyValue
-
getValueLength
Description copied from class:KeyValue
Returns Value length- Specified by:
getValueLength
in interfaceCell
- Overrides:
getValueLength
in classKeyValue
-
getTagsLength
Description copied from class:KeyValue
Return the total length of the tag bytes- Specified by:
getTagsLength
in interfaceRawCell
- Overrides:
getTagsLength
in classKeyValue
- Returns:
- the total length of the tags in the Cell.
-
toString
-
hashCode
Description copied from class:KeyValue
In line withKeyValue.equals(Object)
, only uses the key portion, not the value. -
equals
Description copied from class:KeyValue
Needed doing 'contains' on List. Only compares the key portion, not the value. -
heapSize
Description copied from class:KeyValue
HeapSize 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:ExtendedCell
Write this cell to an OutputStream in aKeyValue
format.
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:
write
in interfaceExtendedCell
- Overrides:
write
in classKeyValue
- Parameters:
out
- Stream to which cell has to be writtenwithTags
- Whether to write tags.- Returns:
- how many bytes are written.
- Throws:
IOException
-