Class KeyValue.KVComparator

java.lang.Object
org.apache.hadoop.hbase.KeyValue.KVComparator
All Implemented Interfaces:
Comparator<Cell>, KeyValue.SamePrefixComparator<byte[]>, org.apache.hadoop.io.RawComparator<Cell>
Direct Known Subclasses:
KeyValue.MetaComparator
Enclosing class:
KeyValue

@Deprecated public static class KeyValue.KVComparator extends Object implements org.apache.hadoop.io.RawComparator<Cell>, KeyValue.SamePrefixComparator<byte[]>
Deprecated.
: Use CellComparatorImpl. Deprecated for hbase 2.0, remove for hbase 3.0.
Compare KeyValues. When we compare KeyValues, we only compare the Key portion. This means two KeyValues with same Key but different Values are considered the same as far as this Comparator is concerned.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    calcIndexKey(byte[] lastKeyOfPreviousBlock, byte[] firstKeyInBlock)
    Deprecated.
     
    Deprecated.
     
    int
    compare(byte[] l, int loff, int llen, byte[] r, int roff, int rlen)
    Deprecated.
     
    int
    compare(Cell left, Cell right)
    Deprecated.
    Compares the Key of a cell -- with fields being more significant in this order: rowkey, colfam/qual, timestamp, type, mvcc
    protected int
    compareColumns(byte[] left, int loffset, int lquallength, byte[] right, int roffset, int rquallength)
    Deprecated.
     
    protected int
    compareColumns(byte[] left, int loffset, int llength, int lfamilylength, byte[] right, int roffset, int rlength, int rfamilylength)
    Deprecated.
     
    (package private) int
    compareColumns(Cell left, short lrowlength, Cell right, short rrowlength)
    Deprecated.
     
    protected int
    compareFamilies(byte[] left, int loffset, int lfamilylength, byte[] right, int roffset, int rfamilylength)
    Deprecated.
     
    int
    compareFlatKey(byte[] left, byte[] right)
    Deprecated.
     
    int
    compareFlatKey(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
    Deprecated.
    Compares left to right assuming that left,loffset,llength and right,roffset,rlength are full KVs laid out in a flat byte[]s.
    int
    compareIgnoringPrefix(int commonPrefix, byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
    Deprecated.
    Overridden
    int
    compareKey(Cell cell, byte[] row, int roff, int rlen, byte[] fam, int foff, int flen, byte[] col, int coff, int clen, long ts, byte type)
    Deprecated.
     
    int
    Deprecated.
     
    protected int
    compareRowKey(Cell left, Cell right)
    Deprecated.
    Compares the only the user specified portion of a Key.
    int
    compareRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
    Deprecated.
    Get the b[],o,l for left and right rowkey portions and compare.
    int
    compareRows(Cell left, Cell right)
    Deprecated.
    Compares the rows of a cell
    (package private) static int
    compareTimestamps(long ltimestamp, long rtimestamp)
    Deprecated.
     
    int
    compareTimestamps(Cell left, Cell right)
    Deprecated.
     
    private int
    compareWithoutRow(int commonPrefix, byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength, short rowlength)
    Deprecated.
    Compare columnFamily, qualifier, timestamp, and key type (everything except the row).
    Deprecated.
    The HFileV2 file format's trailer contains this class name.
    byte[]
    getShortMidpointKey(byte[] leftKey, byte[] rightKey)
    Deprecated.
    Since 0.99.2;
    boolean
    matchingRowColumn(Cell left, Cell right)
    Deprecated.
    Compares the row and column of two keyvalues for equality
    boolean
    matchingRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
    Deprecated.
    Compare rows.
    private boolean
    matchingRows(Cell left, short lrowlength, Cell right, short rrowlength)
    Deprecated.
    Compares the row of two keyvalues for equality
    boolean
    matchingRows(Cell left, Cell right)
    Deprecated.
    Compares the row of two keyvalues for equality

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getLegacyKeyComparatorName

      Deprecated.
      The HFileV2 file format's trailer contains this class name. We reinterpret this and instantiate the appropriate comparator. TODO: With V3 consider removing this.
      Returns:
      legacy class name for FileFileTrailer#comparatorClassName
    • compare

      public int compare(byte[] l, int loff, int llen, byte[] r, int roff, int rlen)
      Deprecated.
      Specified by:
      compare in interface org.apache.hadoop.io.RawComparator<Cell>
    • compareRowKey

      protected int compareRowKey(Cell left, Cell right)
      Deprecated.
      Compares the only the user specified portion of a Key. This is overridden by MetaComparator.
      Parameters:
      left - left cell to compare row key
      right - right cell to compare row key
      Returns:
      0 if equal, <0 if left smaller, >0 if right smaller
    • compareFlatKey

      public int compareFlatKey(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
      Deprecated.
      Compares left to right assuming that left,loffset,llength and right,roffset,rlength are full KVs laid out in a flat byte[]s.
      Parameters:
      left - the left kv serialized byte[] to be compared with
      loffset - the offset in the left byte[]
      llength - the length in the left byte[]
      right - the right kv serialized byte[] to be compared with
      roffset - the offset in the right byte[]
      rlength - the length in the right byte[]
      Returns:
      0 if equal, <0 if left smaller, >0 if right smaller
    • compareFlatKey

      public int compareFlatKey(byte[] left, byte[] right)
      Deprecated.
    • compareKey

      public int compareKey(Cell cell, byte[] row, int roff, int rlen, byte[] fam, int foff, int flen, byte[] col, int coff, int clen, long ts, byte type)
      Deprecated.
    • compareOnlyKeyPortion

      public int compareOnlyKeyPortion(Cell left, Cell right)
      Deprecated.
    • compare

      public int compare(Cell left, Cell right)
      Deprecated.
      Compares the Key of a cell -- with fields being more significant in this order: rowkey, colfam/qual, timestamp, type, mvcc
      Specified by:
      compare in interface Comparator<Cell>
    • compareTimestamps

      public int compareTimestamps(Cell left, Cell right)
      Deprecated.
    • compareRows

      public int compareRows(Cell left, Cell right)
      Deprecated.
      Compares the rows of a cell
      Parameters:
      left - left cell to compare rows for
      right - right cell to compare rows for
      Returns:
      Result comparing rows.
    • compareRows

      public int compareRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
      Deprecated.
      Get the b[],o,l for left and right rowkey portions and compare.
      Parameters:
      left - the left kv serialized byte[] to be compared with
      loffset - the offset in the left byte[]
      llength - the length in the left byte[]
      right - the right kv serialized byte[] to be compared with
      roffset - the offset in the right byte[]
      rlength - the length in the right byte[]
      Returns:
      0 if equal, <0 if left smaller, >0 if right smaller
    • compareColumns

      int compareColumns(Cell left, short lrowlength, Cell right, short rrowlength)
      Deprecated.
    • compareColumns

      protected int compareColumns(byte[] left, int loffset, int llength, int lfamilylength, byte[] right, int roffset, int rlength, int rfamilylength)
      Deprecated.
    • compareTimestamps

      static int compareTimestamps(long ltimestamp, long rtimestamp)
      Deprecated.
    • compareIgnoringPrefix

      public int compareIgnoringPrefix(int commonPrefix, byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
      Deprecated.
      Overridden
      Specified by:
      compareIgnoringPrefix in interface KeyValue.SamePrefixComparator<byte[]>
      Parameters:
      commonPrefix - location of expected common prefix
      left - the left kv serialized byte[] to be compared with
      loffset - the offset in the left byte[]
      llength - the length in the left byte[]
      right - the right kv serialized byte[] to be compared with
      roffset - the offset in the byte[]
      rlength - the length in the right byte[]
      Returns:
      0 if equal, <0 if left smaller, >0 if right smaller
    • compareWithoutRow

      private int compareWithoutRow(int commonPrefix, byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength, short rowlength)
      Deprecated.
      Compare columnFamily, qualifier, timestamp, and key type (everything except the row). This method is used both in the normal comparator and the "same-prefix" comparator. Note that we are assuming that row portions of both KVs have already been parsed and found identical, and we don't validate that assumption here. the length of the common prefix of the two key-values being compared, including row length and row
    • compareFamilies

      protected int compareFamilies(byte[] left, int loffset, int lfamilylength, byte[] right, int roffset, int rfamilylength)
      Deprecated.
    • compareColumns

      protected int compareColumns(byte[] left, int loffset, int lquallength, byte[] right, int roffset, int rquallength)
      Deprecated.
    • matchingRowColumn

      public boolean matchingRowColumn(Cell left, Cell right)
      Deprecated.
      Compares the row and column of two keyvalues for equality
      Parameters:
      left - left cell to compare row and column
      right - right cell to compare row and column
      Returns:
      True if same row and column.
    • matchingRows

      public boolean matchingRows(Cell left, Cell right)
      Deprecated.
      Compares the row of two keyvalues for equality
      Parameters:
      left - left cell to compare row
      right - right cell to compare row
      Returns:
      True if rows match.
    • matchingRows

      private boolean matchingRows(Cell left, short lrowlength, Cell right, short rrowlength)
      Deprecated.
      Compares the row of two keyvalues for equality
      Parameters:
      left - left cell to compare row
      lrowlength - left row length
      right - right cell to compare row
      rrowlength - right row length
      Returns:
      True if rows match.
    • matchingRows

      public boolean matchingRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
      Deprecated.
      Compare rows. Just calls Bytes.equals, but it's good to have this encapsulated.
      Parameters:
      left - Left row array.
      loffset - Left row offset.
      llength - Left row length.
      right - Right row array.
      roffset - Right row offset.
      rlength - Right row length.
      Returns:
      Whether rows are the same row.
    • calcIndexKey

      public byte[] calcIndexKey(byte[] lastKeyOfPreviousBlock, byte[] firstKeyInBlock)
      Deprecated.
    • getShortMidpointKey

      @Deprecated public byte[] getShortMidpointKey(byte[] leftKey, byte[] rightKey)
      Deprecated.
      Since 0.99.2;
      This is a HFile block index key optimization.
      Parameters:
      leftKey - byte array for left Key
      rightKey - byte array for right Key
      Returns:
      0 if equal, <0 if left smaller, >0 if right smaller
    • clone

      Deprecated.
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException