Class CellUtil

java.lang.Object
org.apache.hadoop.hbase.CellUtil

@Public public final class CellUtil extends Object
Utility methods helpful for slinging Cell instances. Some methods below are for internal use only and are marked InterfaceAudience.Private at the method level. Note that all such methods have been marked deprecated in HBase-2.0 which will be subsequently removed in HBase-3.0
  • Constructor Details

    • CellUtil

      private CellUtil()
      Private constructor to keep this class from being instantiated.
  • Method Details

    • fillRowRange

      @Deprecated public static ByteRange fillRowRange(Cell cell, ByteRange range)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0.
    • fillFamilyRange

      @Deprecated public static ByteRange fillFamilyRange(Cell cell, ByteRange range)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0.
    • fillQualifierRange

      @Deprecated public static ByteRange fillQualifierRange(Cell cell, ByteRange range)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0.
    • fillValueRange

      @Deprecated public static ByteRange fillValueRange(Cell cell, ByteRange range)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0.
    • fillTagRange

      @Deprecated public static ByteRange fillTagRange(Cell cell, ByteRange range)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0.
    • cloneRow

      public static byte[] cloneRow(Cell cell)
      get individual arrays for tests
    • cloneFamily

      public static byte[] cloneFamily(Cell cell)
    • cloneQualifier

      public static byte[] cloneQualifier(Cell cell)
    • cloneValue

      public static byte[] cloneValue(Cell cell)
    • cloneTags

      @Deprecated public static byte[] cloneTags(Cell cell)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0. Use RawCell.cloneTags()
    • getTagArray

      @Deprecated public static byte[] getTagArray(Cell cell)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Returns tag value in a new byte array. If server-side, use Tag.getValueArray() with appropriate Tag.getValueOffset() and Tag.getValueLength() instead to save on allocations.
      Returns:
      tag value in a new byte array.
    • makeColumn

      public static byte[] makeColumn(byte[] family, byte[] qualifier)
      Makes a column in family:qualifier form from separate byte arrays.

      Not recommended for usage as this is old-style API.

      Returns:
      family:qualifier
    • parseColumn

      public static byte[][] parseColumn(byte[] c)
      Splits a column in family:qualifier form into separate byte arrays. An empty qualifier (ie, fam:) is parsed as { fam, EMPTY_BYTE_ARRAY } while no delimiter (ie, fam) is parsed as an array of one element, { fam }.

      Don't forget, HBase DOES support empty qualifiers. (see HBASE-9549)

      Not recommend to be used as this is old-style API.

      Parameters:
      c - The column.
      Returns:
      The parsed column.
    • copyRowTo

      public static int copyRowTo(Cell cell, byte[] destination, int destinationOffset)
      Copies the row to the given byte[]
      Parameters:
      cell - the cell whose row has to be copied
      destination - the destination byte[] to which the row has to be copied
      destinationOffset - the offset in the destination byte[]
      Returns:
      the offset of the byte[] after the copy has happened
    • copyRowTo

      public static int copyRowTo(Cell cell, ByteBuffer destination, int destinationOffset)
      Copies the row to the given bytebuffer
      Parameters:
      cell - cell the cell whose row has to be copied
      destination - the destination bytebuffer to which the row has to be copied
      destinationOffset - the offset in the destination byte[]
      Returns:
      the offset of the bytebuffer after the copy has happened
    • copyRow

      public static byte[] copyRow(Cell cell)
      Copies the row to a new byte[]
      Parameters:
      cell - the cell from which row has to copied
      Returns:
      the byte[] containing the row
    • copyFamilyTo

      public static int copyFamilyTo(Cell cell, byte[] destination, int destinationOffset)
      Copies the family to the given byte[]
      Parameters:
      cell - the cell whose family has to be copied
      destination - the destination byte[] to which the family has to be copied
      destinationOffset - the offset in the destination byte[]
      Returns:
      the offset of the byte[] after the copy has happened
    • copyFamilyTo

      public static int copyFamilyTo(Cell cell, ByteBuffer destination, int destinationOffset)
      Copies the family to the given bytebuffer
      Parameters:
      cell - the cell whose family has to be copied
      destination - the destination bytebuffer to which the family has to be copied
      destinationOffset - the offset in the destination bytebuffer
      Returns:
      the offset of the bytebuffer after the copy has happened
    • copyQualifierTo

      public static int copyQualifierTo(Cell cell, byte[] destination, int destinationOffset)
      Copies the qualifier to the given byte[]
      Parameters:
      cell - the cell whose qualifier has to be copied
      destination - the destination byte[] to which the qualifier has to be copied
      destinationOffset - the offset in the destination byte[]
      Returns:
      the offset of the byte[] after the copy has happened
    • copyQualifierTo

      public static int copyQualifierTo(Cell cell, ByteBuffer destination, int destinationOffset)
      Copies the qualifier to the given bytebuffer
      Parameters:
      cell - the cell whose qualifier has to be copied
      destination - the destination bytebuffer to which the qualifier has to be copied
      destinationOffset - the offset in the destination bytebuffer
      Returns:
      the offset of the bytebuffer after the copy has happened
    • copyValueTo

      public static int copyValueTo(Cell cell, byte[] destination, int destinationOffset)
      Copies the value to the given byte[]
      Parameters:
      cell - the cell whose value has to be copied
      destination - the destination byte[] to which the value has to be copied
      destinationOffset - the offset in the destination byte[]
      Returns:
      the offset of the byte[] after the copy has happened
    • copyValueTo

      public static int copyValueTo(Cell cell, ByteBuffer destination, int destinationOffset)
      Copies the value to the given bytebuffer
      Parameters:
      cell - the cell whose value has to be copied
      destination - the destination bytebuffer to which the value has to be copied
      destinationOffset - the offset in the destination bytebuffer
      Returns:
      the offset of the bytebuffer after the copy has happened
    • copyTagTo

      @Deprecated public static int copyTagTo(Cell cell, byte[] destination, int destinationOffset)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0.
      Copies the tags info into the tag portion of the cell
      Returns:
      position after tags
    • copyTagTo

      @Deprecated public static int copyTagTo(Cell cell, ByteBuffer destination, int destinationOffset)
      Deprecated.
      As of HBase-2.0. Will be removed in 3.0.
      Copies the tags info into the tag portion of the cell
      Returns:
      position after tags
    • getRowByte

      @Private @Deprecated public static byte getRowByte(Cell cell, int index)
      Deprecated.
      misc
    • getValueBufferShallowCopy

      Deprecated.
      As of HBase-2.0. Will be removed in 3.0.
    • getQualifierBufferShallowCopy

      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Return cell's qualifier wrapped into a ByteBuffer.
    • createCell

      @Deprecated public static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte type, byte[] value)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use CellBuilder instead
      Create a cell
    • createCell

      @Deprecated public static Cell createCell(byte[] rowArray, int rowOffset, int rowLength, byte[] familyArray, int familyOffset, int familyLength, byte[] qualifierArray, int qualifierOffset, int qualifierLength)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use CellBuilder instead
      Creates a cell with deep copy of all passed bytes.
    • createCell

      @Private @Deprecated public static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte type, byte[] value, long memstoreTS)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use ExtendedCellBuilder instead
      Marked as audience Private as of 1.2.0. Creating a Cell with a memstoreTS/mvcc is an internal implementation detail not for public use.
    • createCell

      @Private @Deprecated public static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, byte type, byte[] value, byte[] tags, long memstoreTS)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use ExtendedCellBuilder instead
      Marked as audience Private as of 1.2.0. Creating a Cell with tags and a memstoreTS/mvcc is an internal implementation detail not for public use.
    • createCell

      @Private @Deprecated public static Cell createCell(byte[] row, byte[] family, byte[] qualifier, long timestamp, KeyValue.Type type, byte[] value, byte[] tags)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use ExtendedCellBuilder instead
      Marked as audience Private as of 1.2.0. Creating a Cell with tags is an internal implementation detail not for public use.
    • createCell

      @Deprecated public static Cell createCell(byte[] row)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use CellBuilder instead
      Create a Cell with specific row. Other fields defaulted.
      Returns:
      Cell with passed row but all other fields are arbitrary
    • createCell

      @Deprecated public static Cell createCell(byte[] row, byte[] value)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use CellBuilder instead
      Create a Cell with specific row and value. Other fields are defaulted.
      Returns:
      Cell with passed row and value but all other fields are arbitrary
    • createCell

      @Deprecated public static Cell createCell(byte[] row, byte[] family, byte[] qualifier)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use CellBuilder instead
      Create a Cell with specific row. Other fields defaulted.
      Returns:
      Cell with passed row but all other fields are arbitrary
    • createCell

      @Deprecated public static Cell createCell(Cell cell, List<Tag> tags)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Note : Now only CPs can create cell with tags using the CP environment Within CP, use RawCell.createCell(Cell, List) method instead
      Returns:
      A new cell which is having the extra tags also added to it.
    • createCell

      @Deprecated public static Cell createCell(Cell cell, byte[] tags)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Now only CPs can create cell with tags using the CP environment Within CP, use RawCell.createCell(Cell, List) method instead
      Returns:
      A new cell which is having the extra tags also added to it.
    • createCell

      @Deprecated public static Cell createCell(Cell cell, byte[] value, byte[] tags)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Now only CPs can create cell with tags using the CP environment Within CP, use RawCell.createCell(Cell, List) method instead
    • createCellScanner

      public static CellScanner createCellScanner(List<? extends CellScannable> cellScannerables)
      Returns CellScanner interface over cellIterables
    • createCellScanner

      public static CellScanner createCellScanner(Iterable<Cell> cellIterable)
      Returns CellScanner interface over cellIterable
    • createCellScanner

      public static CellScanner createCellScanner(Iterator<Cell> cells)
      Returns CellScanner interface over cellIterable or null if cells is null
    • createCellScanner

      public static CellScanner createCellScanner(Cell[] cellArray)
      Returns CellScanner interface over cellArray
    • createCellScanner

      public static CellScanner createCellScanner(NavigableMap<byte[],List<Cell>> map)
      Flatten the map of cells out under the CellScanner
      Parameters:
      map - Map of Cell Lists; for example, the map of families to Cells that is used inside Put, etc., keeping Cells organized by family.
      Returns:
      CellScanner interface over cellIterable
    • matchingRow

      @Deprecated public static boolean matchingRow(Cell left, Cell right)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Instead use matchingRows(Cell, Cell)
      Return true if the rows in left and right Cells match
    • matchingRow

      @Deprecated public static boolean matchingRow(Cell left, byte[] buf)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Instead use matchingRows(Cell, byte[])
      Return true if the row is matching
    • matchingRows

      public static boolean matchingRows(Cell left, byte[] buf)
    • matchingRow

      @Deprecated public static boolean matchingRow(Cell left, byte[] buf, int offset, int length)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Instead use matchingRows(Cell, Cell)
      Return true if the row is matching
    • matchingFamily

      public static boolean matchingFamily(Cell left, Cell right)
    • matchingFamily

      public static boolean matchingFamily(Cell left, byte lfamlength, Cell right, byte rfamlength)
    • matchingFamily

      public static boolean matchingFamily(Cell left, byte[] buf)
    • matchingFamily

      @Deprecated public static boolean matchingFamily(Cell left, byte[] buf, int offset, int length)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Return true if the family is matching
    • matchingQualifier

      public static boolean matchingQualifier(Cell left, Cell right)
    • matchingQualifier

      private static boolean matchingQualifier(Cell left, int lqlength, Cell right, int rqlength)
    • matchingQualifier

      public static boolean matchingQualifier(Cell left, byte[] buf)
      Finds if the qualifier part of the cell and the KV serialized byte[] are equal.
      Returns:
      true if the qualifier matches, false otherwise
    • matchingQualifier

      @Deprecated public static boolean matchingQualifier(Cell left, byte[] buf, int offset, int length)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Finds if the qualifier part of the cell and the KV serialized byte[] are equal
      Parameters:
      buf - the serialized keyvalue format byte[]
      offset - the offset of the qualifier in the byte[]
      length - the length of the qualifier in the byte[]
      Returns:
      true if the qualifier matches, false otherwise
    • matchingColumn

      public static boolean matchingColumn(Cell left, byte[] fam, byte[] qual)
    • matchingColumnFamilyAndQualifierPrefix

      public static boolean matchingColumnFamilyAndQualifierPrefix(Cell left, byte[] fam, byte[] qual)
      Returns True if matching column family and the qualifier starts with qual
    • matchingColumn

      @Deprecated public static boolean matchingColumn(Cell left, byte[] fam, int foffset, int flength, byte[] qual, int qoffset, int qlength)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Return true if the column is matching
    • matchingColumn

      public static boolean matchingColumn(Cell left, Cell right)
    • matchingColumn

      private static boolean matchingColumn(Cell left, byte lFamLen, int lQualLength, Cell right, byte rFamLen, int rQualLength)
    • matchingValue

      public static boolean matchingValue(Cell left, Cell right)
    • matchingValue

      public static boolean matchingValue(Cell left, byte[] buf)
    • matchingTags

      public static boolean matchingTags(Cell left, Cell right)
    • isDelete

      public static boolean isDelete(Cell cell)
      Return true if a delete type, a KeyValue.Type.Delete or a {KeyValue.Type#DeleteFamily} or a KeyValue.Type.DeleteColumn KeyValue type.
    • isDelete

      @Deprecated public static boolean isDelete(byte type)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Return true if a delete type, a KeyValue.Type.Delete or a {KeyValue.Type#DeleteFamily} or a KeyValue.Type.DeleteColumn KeyValue type.
    • isDeleteType

      @Deprecated public static boolean isDeleteType(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Return true if this cell is a KeyValue.Type.Delete type.
    • isDeleteFamily

      @Deprecated public static boolean isDeleteFamily(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Check whether the given cell is a delete family
    • isDeleteFamilyVersion

      @Deprecated public static boolean isDeleteFamilyVersion(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Check whether the given cell is a delete family version
    • isDeleteColumns

      @Deprecated public static boolean isDeleteColumns(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Check whether the given cell is a delete columns
    • isDeleteColumnVersion

      @Deprecated public static boolean isDeleteColumnVersion(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Check whether the given cell is a delete column version
    • isDeleteColumnOrFamily

      @Deprecated public static boolean isDeleteColumnOrFamily(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Return true if this cell is a delete family or column type.
    • isPut

      public static boolean isPut(Cell cell)
      Returns True if this cell is a Put.
    • estimatedSerializedSizeOf

      @Deprecated public static int estimatedSerializedSizeOf(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Estimate based on keyvalue's serialization format in the RPC layer. Note that there is an extra SIZEOF_INT added to the size here that indicates the actual length of the cell for cases where cell's are serialized in a contiguous format (For eg in RPCs).
      Returns:
      Estimate of the cell size in bytes plus an extra SIZEOF_INT indicating the actual cell length.
    • getSumOfCellElementLengths

      private static int getSumOfCellElementLengths(Cell cell)
      Return sum of the lengths of all the elements in a Cell; does not count in any infrastructure
    • getSumOfCellKeyElementLengths

      private static int getSumOfCellKeyElementLengths(Cell cell)
      Return sum of all elements that make up a key; does not include infrastructure, tags or values.
    • estimatedSerializedSizeOfKey

      @Deprecated public static int estimatedSerializedSizeOfKey(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0.
      Calculates the serialized key size. We always serialize in the KeyValue's serialization format.
      Parameters:
      cell - the cell for which the key size has to be calculated.
      Returns:
      the key size
    • estimatedHeapSizeOf

      @Deprecated public static long estimatedHeapSizeOf(Cell cell)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use RawCell.getTags()
      This is an estimate of the heap space occupied by a cell. When the cell is of type HeapSize we call HeapSize.heapSize() so cell can give a correct value. In other cases we just consider the bytes occupied by the cell components ie. row, CF, qualifier, timestamp, type, value and tags.
      Returns:
      estimate of the heap space
    • tagsIterator

      @Deprecated public static Iterator<Tag> tagsIterator(byte[] tags, int offset, int length)
      Deprecated.
      As of 2.0.0 and will be removed in 3.0.0 Instead use PrivateCellUtil.tagsIterator(Cell)
      Util method to iterate through the tags
      Returns:
      iterator for the tags
    • getTags

      @Deprecated public static List<Tag> getTags(Cell cell)
      Deprecated.
      As of 2.0.0 and will be removed in 3.0.0
      Return tags in the given Cell as a List
    • getTag

      @Deprecated public static Tag getTag(Cell cell, byte type)
      Deprecated.
      As of 2.0.0 and will be removed in HBase-3.0.0 Use RawCell.getTag(byte)
      Retrieve Cell's first tag, matching the passed in type
      Parameters:
      cell - The Cell
      type - Type of the Tag to retrieve
      Returns:
      null if there is no tag of the passed in tag type
    • overlappingKeys

      @Deprecated public static boolean overlappingKeys(byte[] start1, byte[] end1, byte[] start2, byte[] end2)
      Deprecated.
      As of 2.0.0 and will be removed in 3.0.0
      Returns true if the first range start1...end1 overlaps with the second range start2...end2, assuming the byte arrays represent row keys
    • setSequenceId

      @Deprecated public static void setSequenceId(Cell cell, long seqId) throws IOException
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Sets the given seqId to the cell. Marked as audience Private as of 1.2.0. Setting a Cell sequenceid is an internal implementation detail not for general public use.
      Throws:
      IOException - when the passed cell is not of type ExtendedCell
    • setTimestamp

      @Deprecated public static void setTimestamp(Cell cell, long ts) throws IOException
      Deprecated.
      As of HBase-2.0. Will be a LimitedPrivate API in HBase-3.0.
      Sets the given timestamp to the cell. Note that this method is a LimitedPrivate API and may change between minor releases.
      Throws:
      IOException - when the passed cell is not of type ExtendedCell
    • setTimestamp

      @Deprecated public static void setTimestamp(Cell cell, byte[] ts, int tsOffset) throws IOException
      Deprecated.
      As of HBase-2.0. Will be a LimitedPrivate API in HBase-3.0.
      Sets the given timestamp to the cell. Note that this method is a LimitedPrivate API and may change between minor releases.
      Throws:
      IOException - when the passed cell is not of type ExtendedCell
    • updateLatestStamp

      @Deprecated public static boolean updateLatestStamp(Cell cell, long ts) throws IOException
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Sets the given timestamp to the cell iff current timestamp is HConstants.LATEST_TIMESTAMP.
      Returns:
      True if cell timestamp is modified.
      Throws:
      IOException - when the passed cell is not of type ExtendedCell
    • updateLatestStamp

      @Deprecated public static boolean updateLatestStamp(Cell cell, byte[] ts, int tsOffset) throws IOException
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Sets the given timestamp to the cell iff current timestamp is HConstants.LATEST_TIMESTAMP.
      Parameters:
      ts - buffer containing the timestamp value
      tsOffset - offset to the new timestamp
      Returns:
      True if cell timestamp is modified.
      Throws:
      IOException - when the passed cell is not of type ExtendedCell
    • writeFlatKey

      @Deprecated public static void writeFlatKey(Cell cell, DataOutputStream out) throws IOException
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Writes the Cell's key part as it would have serialized in a KeyValue. The format is <2 bytes rk len><rk><1 byte cf len><cf><qualifier><8 bytes timestamp><1 byte type>
      Throws:
      IOException
    • writeRowSkippingBytes

      @Deprecated public static void writeRowSkippingBytes(DataOutputStream out, Cell cell, short rlength, int commonPrefix) throws IOException
      Deprecated.
      As of 2.0. Will be removed in hbase-3.0
      Writes the row from the given cell to the output stream excluding the common prefix
      Parameters:
      out - The dataoutputstream to which the data has to be written
      cell - The cell whose contents has to be written
      rlength - the row length
      Throws:
      IOException
    • getCellKeyAsString

      public static String getCellKeyAsString(Cell cell)
      Return the key portion of the passed cell as a String.
    • getCellKeyAsString

      public static String getCellKeyAsString(Cell cell, Function<Cell,String> rowConverter)
      Return the Key portion of the passed cell as a String.
      Parameters:
      cell - the cell to convert
      rowConverter - used to convert the row of the cell to a string
      Returns:
      The Key portion of the passed cell as a String.
    • getCellKeySerializedAsKeyValueKey

      @Deprecated public static byte[] getCellKeySerializedAsKeyValueKey(Cell cell)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      This method exists just to encapsulate how we serialize keys. To be replaced by a factory that we query to figure what the Cell implementation is and then, what serialization engine to use and further, how to serialize the key for inclusion in hfile index. TODO.
      Returns:
      The key portion of the Cell serialized in the old-school KeyValue way or null if passed a null cell
    • writeRowKeyExcludingCommon

      @Deprecated public static void writeRowKeyExcludingCommon(Cell cell, short rLen, int commonPrefix, DataOutputStream out) throws IOException
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Write rowkey excluding the common part.
      Throws:
      IOException
    • findCommonPrefixInFlatKey

      @Deprecated public static int findCommonPrefixInFlatKey(Cell c1, Cell c2, boolean bypassFamilyCheck, boolean withTsType)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Find length of common prefix in keys of the cells, considering key as byte[] if serialized in KeyValue. The key format is <2 bytes rk len><rk><1 byte cf len><cf><qualifier><8 bytes timestamp><1 byte type>
      Parameters:
      c1 - the cell
      c2 - the cell
      bypassFamilyCheck - when true assume the family bytes same in both cells. Pass it as true when dealing with Cells in same CF so as to avoid some checks
      withTsType - when true check timestamp and type bytes also.
      Returns:
      length of common prefix
    • toString

      public static String toString(Cell cell, boolean verbose)
      Returns a string representation of the cell
    • equalsIgnoreMvccVersion

      @Deprecated public static boolean equalsIgnoreMvccVersion(Cell a, Cell b)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      special case for Cell.equals
    • equals

      public static boolean equals(Cell a, Cell b)
      equals
    • matchingTimestamp

      public static boolean matchingTimestamp(Cell a, Cell b)
    • matchingType

      @Deprecated public static boolean matchingType(Cell a, Cell b)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Check whether the type of these two cells are the same
    • matchingRows

      public static boolean matchingRows(Cell left, Cell right)
      Compares the row of two keyvalues for equality
    • matchingRows

      public static boolean matchingRows(Cell left, short lrowlength, Cell right, short rrowlength)
      Compares the row of two keyvalues for equality
    • matchingRowColumn

      public static boolean matchingRowColumn(Cell left, Cell right)
      Compares the row and column of two keyvalues for equality
    • matchingRowColumnBytes

      public static boolean matchingRowColumnBytes(Cell left, Cell right)
      Compares the row and column of two keyvalues for equality
    • compareQualifiers

      public static final int compareQualifiers(Cell left, byte[] right, int rOffset, int rLength)
      Compares the cell's qualifier with the given byte[]
      Parameters:
      left - the cell for which the qualifier has to be compared
      right - the byte[] having the qualifier
      rOffset - the offset of the qualifier
      rLength - the length of the qualifier
      Returns:
      greater than 0 if left cell's qualifier is bigger than byte[], lesser than 0 if left cell's qualifier is lesser than byte[] and 0 otherwise
    • compare

      @Private @Deprecated public static final int compare(CellComparator comparator, Cell left, byte[] key, int offset, int length)
      Deprecated.
      As of HBase-2.0. Will be removed in HBase-3.0
      Used when a cell needs to be compared with a key byte[] such as cases of finding the index from the index block, bloom keys from the bloom blocks This byte[] is expected to be serialized in the KeyValue serialization format If the KeyValue (Cell's) serialization format changes this method cannot be used.
      Parameters:
      comparator - the cell comparator
      left - the cell to be compared
      key - the serialized key part of a KeyValue
      offset - the offset in the key byte[]
      length - the length of the key byte[]
      Returns:
      an int greater than 0 if left is greater than right lesser than 0 if left is lesser than right equal to 0 if left is equal to right
    • compareFamilies

      public static final int compareFamilies(Cell left, byte[] right, int roffset, int rlength)
      Compares the cell's family with the given byte[]
      Parameters:
      left - the cell for which the family has to be compared
      right - the byte[] having the family
      roffset - the offset of the family
      rlength - the length of the family
      Returns:
      greater than 0 if left cell's family is bigger than byte[], lesser than 0 if left cell's family is lesser than byte[] and 0 otherwise
    • compareColumns

      public static final int compareColumns(Cell left, byte[] right, int rfoffset, int rflength, int rqoffset, int rqlength)
      Compares the cell's column (family and qualifier) with the given byte[]
      Parameters:
      left - the cell for which the column has to be compared
      right - the byte[] having the column
      rfoffset - the offset of the family
      rflength - the length of the family
      rqoffset - the offset of the qualifier
      rqlength - the length of the qualifier
      Returns:
      greater than 0 if left cell's column is bigger than byte[], lesser than 0 if left cell's column is lesser than byte[] and 0 otherwise
    • cloneIfNecessary

      public static void cloneIfNecessary(ArrayList<Cell> cells)
    • cloneIfNecessary

      public static Cell cloneIfNecessary(Cell cell)