Interface Cell

All Superinterfaces:
HeapSize
All Known Subinterfaces:
ExtendedCell, RawCell
All Known Implementing Classes:
BufferedDataBlockEncoder.OffheapDecodedExtendedCell, BufferedDataBlockEncoder.OnheapDecodedCell, ByteBufferChunkKeyValue, ByteBufferExtendedCell, ByteBufferKeyOnlyKeyValue, ByteBufferKeyValue, IndividualBytesFieldCell, KeyOnlyFilter.KeyOnlyByteBufferExtendedCell, KeyOnlyFilter.KeyOnlyCell, KeyValue, KeyValue.KeyOnlyKeyValue, MapReduceExtendedCell, NoTagByteBufferChunkKeyValue, NoTagsByteBufferKeyValue, NoTagsKeyValue, PrivateCellUtil.EmptyByteBufferExtendedCell, PrivateCellUtil.EmptyCell, PrivateCellUtil.FirstOnRowByteBufferExtendedCell, PrivateCellUtil.FirstOnRowCell, PrivateCellUtil.FirstOnRowColByteBufferExtendedCell, PrivateCellUtil.FirstOnRowColCell, PrivateCellUtil.FirstOnRowColTSByteBufferExtendedCell, PrivateCellUtil.FirstOnRowColTSCell, PrivateCellUtil.FirstOnRowDeleteFamilyCell, PrivateCellUtil.LastOnRowByteBufferExtendedCell, PrivateCellUtil.LastOnRowCell, PrivateCellUtil.LastOnRowColByteBufferExtendedCell, PrivateCellUtil.LastOnRowColCell, PrivateCellUtil.TagRewriteByteBufferExtendedCell, PrivateCellUtil.TagRewriteCell, PrivateCellUtil.ValueAndTagRewriteByteBufferExtendedCell, PrivateCellUtil.ValueAndTagRewriteCell, SizeCachedByteBufferKeyValue, SizeCachedKeyValue, SizeCachedNoTagsByteBufferKeyValue, SizeCachedNoTagsKeyValue

@Public public interface Cell extends HeapSize
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.

Cell implements Comparable<Cell> 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.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The valid types for user to build the cell.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Contiguous bytes composed of legal HDFS filename characters which may start at any index in the containing array.
    byte
    Returns Number of family bytes.
    int
    Returns Array index of first family byte
    byte[]
    Contiguous raw bytes that may start at any index in the containing array.
    int
    Returns Number of qualifier bytes.
    int
    Returns Array index of first qualifier byte
    byte[]
    Contiguous raw bytes that may start at any index in the containing array.
    short
    Returns Number of row bytes.
    int
    Returns Array index of first row byte
    int
    Returns Serialized size (defaults to include tag length if has some tags).
    long
    Return a long value representing time at which this cell was "Put" into the row.
    Returns the type of cell in a human readable format using Cell.Type.
    byte[]
    Contiguous raw bytes that may start at any index in the containing array.
    int
    Returns Number of value bytes.
    int
    Returns Array index of first value byte

    Methods inherited from interface org.apache.hadoop.hbase.io.HeapSize

    heapSize
  • Method Details

    • 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

      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

      Returns Array index of first family byte
    • getFamilyLength

      Returns Number of family bytes. Must be < familyArray.length - offset.
    • getQualifierArray

      Contiguous raw bytes that may start at any index in the containing array.
      Returns:
      The array containing the qualifier bytes.
    • getQualifierOffset

      Returns Array index of first qualifier byte
    • getQualifierLength

      Returns Number of qualifier bytes. Must be < qualifierArray.length - offset.
    • getTimestamp

      long getTimestamp()
      Return a 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.
    • getType

      Returns the type of cell in a human readable format using Cell.Type.

      Note : This does not expose the internal types of Cells like KeyValue.Type.Maximum and KeyValue.Type.Minimum

      Returns:
      The data type this cell: one of Put, Delete, etc
    • 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,647 bytes.
      Returns:
      The array containing the value bytes.
    • getValueOffset

      Returns Array index of first value byte
    • getValueLength

      Returns Number of value bytes. Must be < valueArray.length - offset.
    • getSerializedSize

      Returns Serialized size (defaults to include tag length if has some tags).