org.apache.hadoop.hbase
Interface Cell

All Known Implementing Classes:
KeyValue, NoTagsKeyValue

@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface Cell

The unit of storage in HBase consisting of the following fields:

 1) row
 2) column family
 3) column qualifier
 4) timestamp
 5) type
 6) MVCC version
 7) value
 

Uniqueness is determined by the combination of row, column family, column qualifier, timestamp, and type.

The natural comparator will perform a bitwise comparison on row, column family, and column qualifier. Less intuitively, it will then treat the greater timestamp as the lesser value with the goal of sorting newer cells first.

This interface should not include methods that allocate new byte[]'s such as those used in client or debugging code. These users should use the methods found in the CellUtil class. Currently for to minimize the impact of existing applications moving between 0.94 and 0.96, we include the costly helper methods marked as deprecated.

Cell implements Comparable which is only meaningful when comparing to other keys in the same table. It uses CellComparator which does not work on the -ROOT- and hbase:meta tables.

In the future, we may consider adding a boolean isOnHeap() method and a getValueBuffer() method that can be used to pass a value directly from an off-heap ByteBuffer to the network without copying into an on-heap byte[].

Historic note: the original Cell implementation (KeyValue) requires that all fields be encoded as consecutive bytes in the same byte[], whereas this interface allows fields to reside in separate byte[]'s.


Method Summary
 byte[] getFamily()
          Deprecated. as of 0.96, use CellUtil.cloneFamily(Cell)
 byte[] getFamilyArray()
          Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array.
 byte getFamilyLength()
           
 int getFamilyOffset()
           
 long getMvccVersion()
          Internal use only.
 byte[] getQualifier()
          Deprecated. as of 0.96, use CellUtil.cloneQualifier(Cell)
 byte[] getQualifierArray()
          Contiguous raw bytes that may start at any index in the containing array.
 int getQualifierLength()
           
 int getQualifierOffset()
           
 byte[] getRow()
          Deprecated. as of 0.96, use CellUtil.getRowByte(Cell, int)
 byte[] getRowArray()
          Contiguous raw bytes that may start at any index in the containing array.
 short getRowLength()
           
 int getRowOffset()
           
 byte[] getTagsArray()
           
 short getTagsLength()
          Deprecated. use getTagsLengthUnsigned() which can handle tags length upto 65535.
 int getTagsLengthUnsigned()
          Deprecated. From next major version this will be renamed to getTagsLength() which returns int.
 int getTagsOffset()
           
 long getTimestamp()
           
 byte getTypeByte()
           
 byte[] getValue()
          Deprecated. as of 0.96, use CellUtil.cloneValue(Cell)
 byte[] getValueArray()
          Contiguous raw bytes that may start at any index in the containing array.
 int getValueLength()
           
 int getValueOffset()
           
 

Method Detail

getRowArray

byte[] getRowArray()
Contiguous raw bytes that may start at any index in the containing array. Max length is Short.MAX_VALUE which is 32,767 bytes.

Returns:
The array containing the row bytes.

getRowOffset

int getRowOffset()
Returns:
Array index of first row byte

getRowLength

short getRowLength()
Returns:
Number of row bytes. Must be < rowArray.length - offset.

getFamilyArray

byte[] getFamilyArray()
Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array. Max length is Byte.MAX_VALUE, which is 127 bytes.

Returns:
the array containing the family bytes.

getFamilyOffset

int getFamilyOffset()
Returns:
Array index of first family byte

getFamilyLength

byte getFamilyLength()
Returns:
Number of family bytes. Must be < familyArray.length - offset.

getQualifierArray

byte[] getQualifierArray()
Contiguous raw bytes that may start at any index in the containing array. Max length is Short.MAX_VALUE which is 32,767 bytes.

Returns:
The array containing the qualifier bytes.

getQualifierOffset

int getQualifierOffset()
Returns:
Array index of first qualifier byte

getQualifierLength

int getQualifierLength()
Returns:
Number of qualifier bytes. Must be < qualifierArray.length - offset.

getTimestamp

long getTimestamp()
Returns:
Long value representing time at which this cell was "Put" into the row. Typically represents the time of insertion, but can be any value from 0 to Long.MAX_VALUE.

getTypeByte

byte getTypeByte()
Returns:
The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc

getMvccVersion

long getMvccVersion()
Internal use only. A region-specific sequence ID given to each operation. It always exists for cells in the memstore but is not retained forever. It may survive several flushes, but generally becomes irrelevant after the cell's row is no longer involved in any operations that require strict consistency.

Returns:
mvccVersion (always >= 0 if exists), or 0 if it no longer exists

getValueArray

byte[] getValueArray()
Contiguous raw bytes that may start at any index in the containing array. Max length is Integer.MAX_VALUE which is 2,147,483,648 bytes.

Returns:
The array containing the value bytes.

getValueOffset

int getValueOffset()
Returns:
Array index of first value byte

getValueLength

int getValueLength()
Returns:
Number of value bytes. Must be < valueArray.length - offset.

getTagsArray

@InterfaceStability.Unstable
byte[] getTagsArray()
Returns:
the tags byte array

getTagsOffset

@InterfaceStability.Unstable
int getTagsOffset()
Returns:
the first offset where the tags start in the Cell

getTagsLength

@Deprecated
@InterfaceStability.Unstable
short getTagsLength()
Deprecated. use getTagsLengthUnsigned() which can handle tags length upto 65535.

Returns:
the total length of the tags in the Cell.

getTagsLengthUnsigned

@Deprecated
@InterfaceStability.Unstable
int getTagsLengthUnsigned()
Deprecated. From next major version this will be renamed to getTagsLength() which returns int.

Returns:
the total length of the tags in the Cell.

getValue

@Deprecated
byte[] getValue()
Deprecated. as of 0.96, use CellUtil.cloneValue(Cell)

WARNING do not use, expensive. This gets an arraycopy of the cell's value. Added to ease transition from 0.94 -> 0.96.


getFamily

@Deprecated
byte[] getFamily()
Deprecated. as of 0.96, use CellUtil.cloneFamily(Cell)

WARNING do not use, expensive. This gets an arraycopy of the cell's family. Added to ease transition from 0.94 -> 0.96.


getQualifier

@Deprecated
byte[] getQualifier()
Deprecated. as of 0.96, use CellUtil.cloneQualifier(Cell)

WARNING do not use, expensive. This gets an arraycopy of the cell's qualifier. Added to ease transition from 0.94 -> 0.96.


getRow

@Deprecated
byte[] getRow()
Deprecated. as of 0.96, use CellUtil.getRowByte(Cell, int)

WARNING do not use, expensive. this gets an arraycopy of the cell's row. Added to ease transition from 0.94 -> 0.96.



Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.