Class MetaCellComparator

java.lang.Object
org.apache.hadoop.hbase.CellComparatorImpl
org.apache.hadoop.hbase.MetaCellComparator
All Implemented Interfaces:
Serializable, Comparator<Cell>, CellComparator

@Private @Evolving public class MetaCellComparator extends CellComparatorImpl
A CellComparatorImpl for hbase:meta catalog table KeyValues.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • compareRows

      public int compareRows(Cell left, Cell right)
      Description copied from class: CellComparatorImpl
      Compares the rows of the left and right cell. For the hbase:meta case this method is overridden such that it can handle hbase:meta cells. The caller should ensure using the appropriate comparator for hbase:meta.
      Specified by:
      compareRows in interface CellComparator
      Overrides:
      compareRows in class CellComparatorImpl
      Parameters:
      left - the left hand side cell
      right - the right hand side cell
      Returns:
      0 if both cells are equal, 1 if left cell is bigger than right, -1 otherwise
    • compareRows

      public int compareRows(Cell left, byte[] right, int roffset, int rlength)
      Description copied from class: CellComparatorImpl
      Compares the row part of the cell with a simple plain byte[] like the stopRow in Scan. This should be used with context where for hbase:meta cells the {META_COMPARATOR should be used the cell to be compared the kv serialized byte[] to be compared with the offset in the byte[] the length in the byte[]
      Specified by:
      compareRows in interface CellComparator
      Overrides:
      compareRows in class CellComparatorImpl
      Parameters:
      left - the cell
      right - the byte[] representing the row to be compared with
      roffset - the offset of the byte[]
      rlength - the length of the byte[]
      Returns:
      0 if both cell and the byte[] are equal, 1 if the cell is bigger than byte[], -1 otherwise
    • compareRows

      public int compareRows(byte[] leftRow, byte[] rightRow)
      Description copied from interface: CellComparator
      Compares two row bytes
      Parameters:
      leftRow - the byte array of the left row
      rightRow - the byte array of the right row
      Returns:
      greater than 0 if leftRow is bigger, less than 0 if rightRow is bigger, 0 if both rows are equal
    • compare

      public int compare(Cell a, Cell b, boolean ignoreSequenceid)
      Description copied from interface: CellComparator
      Compare cells.
      Specified by:
      compare in interface CellComparator
      Overrides:
      compare in class CellComparatorImpl
      ignoreSequenceid - True if we are to compare the key portion only and ignore the sequenceid. Set to false to compare key and consider sequenceid.
      Returns:
      0 if equal, -1 if a < b, and +1 if a > b.
    • compareRows

      private static <L, R> int compareRows(L left, int loffset, int llength, R right, int roffset, int rlength, MetaCellComparator.SearchDelimiter<L> searchLeft, MetaCellComparator.SearchDelimiter<R> searchRight, MetaCellComparator.SearchDelimiterInReverse<L> searchInReverseLeft, MetaCellComparator.SearchDelimiterInReverse<R> searchInReverseRight, MetaCellComparator.Compare<L,R> comparator)
    • compareBBRows

      private static int compareBBRows(ByteBuffer left, int loffset, int llength, ByteBuffer right, int roffset, int rlength)
    • compareBBAndBytesRows

      private static int compareBBAndBytesRows(ByteBuffer left, int loffset, int llength, byte[] right, int roffset, int rlength)
    • compareBytesRows

      private static int compareBytesRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
    • compareRows

      public int compareRows(ByteBuffer row, Cell cell)
      Description copied from interface: CellComparator
      Lexicographically compare two rows
      Parameters:
      row - ByteBuffer that wraps a row; will read from current position and will reading all remaining; will not disturb the ByteBuffer internal state.
      Returns:
      greater than 0 if leftCell is bigger, less than 0 if rightCell is bigger, 0 if both cells are equal
    • getSimpleComparator

      Description copied from interface: CellComparator
      Return a dumbed-down, fast comparator for hbase2 base-type, the ByteBufferKeyValue. Create an instance when you make a new memstore, when you know only BBKVs will be passed. Do not pollute with types other than BBKV if can be helped; the Comparator will slow.
      Specified by:
      getSimpleComparator in interface CellComparator
      Overrides:
      getSimpleComparator in class CellComparatorImpl