org.apache.hadoop.hbase
Class CellComparator

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

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class CellComparator
extends Object
implements Comparator<Cell>, Serializable

Compare two HBase cells. Do not use this method comparing -ROOT- or hbase:meta cells. Cells from these tables need a specialized comparator, one that takes account of the special formatting of the row where we have commas to delimit table from regionname, from row. See KeyValue for how it has a special comparator to do hbase:meta cells and yet another for -ROOT-.

See Also:
Serialized Form

Constructor Summary
CellComparator()
           
 
Method Summary
static boolean areKeyLengthsEqual(Cell a, Cell b)
          lengths
static boolean areRowLengthsEqual(Cell a, Cell b)
           
 int compare(Cell a, Cell b)
           
static int compareFamilies(Cell left, Cell right)
           
static int compareQualifiers(Cell left, Cell right)
           
static int compareRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
          Do not use comparing rows from hbase:meta.
static int compareRows(Cell left, Cell right)
          Do not use comparing rows from hbase:meta.
static int compareStatic(Cell a, Cell b)
           
static int compareStatic(Cell a, Cell b, boolean onlyKey)
           
static int compareTimestamps(Cell left, Cell right)
          Compares cell's timestamps in DESCENDING order.
static boolean equals(Cell a, Cell b)
          equals
static boolean equalsFamily(Cell a, Cell b)
           
static boolean equalsIgnoreMvccVersion(Cell a, Cell b)
          special case for KeyValue.equals
static boolean equalsQualifier(Cell a, Cell b)
           
static boolean equalsRow(Cell a, Cell b)
           
static boolean equalsTimestamp(Cell a, Cell b)
           
static boolean equalsType(Cell a, Cell b)
           
static int hashCode(Cell cell)
          Returns a hash code that is always the same for two Cells having a matching equals(..) result.
static int hashCodeIgnoreMvcc(Cell cell)
          Returns a hash code that is always the same for two Cells having a matching equals(..) result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

CellComparator

public CellComparator()
Method Detail

compare

public int compare(Cell a,
                   Cell b)
Specified by:
compare in interface Comparator<Cell>

compareStatic

public static int compareStatic(Cell a,
                                Cell b)

compareStatic

public static int compareStatic(Cell a,
                                Cell b,
                                boolean onlyKey)

equals

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


equalsRow

public static boolean equalsRow(Cell a,
                                Cell b)

equalsFamily

public static boolean equalsFamily(Cell a,
                                   Cell b)

equalsQualifier

public static boolean equalsQualifier(Cell a,
                                      Cell b)

equalsTimestamp

public static boolean equalsTimestamp(Cell a,
                                      Cell b)

equalsType

public static boolean equalsType(Cell a,
                                 Cell b)

compareFamilies

public static int compareFamilies(Cell left,
                                  Cell right)

compareQualifiers

public static int compareQualifiers(Cell left,
                                    Cell right)

compareRows

public static int compareRows(Cell left,
                              Cell right)
Do not use comparing rows from hbase:meta. Meta table Cells have schema (table,startrow,hash) so can't be treated as plain byte arrays as this method does.


compareRows

public static int compareRows(byte[] left,
                              int loffset,
                              int llength,
                              byte[] right,
                              int roffset,
                              int rlength)
Do not use comparing rows from hbase:meta. Meta table Cells have schema (table,startrow,hash) so can't be treated as plain byte arrays as this method does.


compareTimestamps

public static int compareTimestamps(Cell left,
                                    Cell right)
Compares cell's timestamps in DESCENDING order. The below older timestamps sorting ahead of newer timestamps looks wrong but it is intentional. This way, newer timestamps are first found when we iterate over a memstore and newer versions are the first we trip over when reading from a store file.

Returns:
1 if left's timestamp < right's timestamp -1 if left's timestamp > right's timestamp 0 if both timestamps are equal

hashCode

public static int hashCode(Cell cell)
Returns a hash code that is always the same for two Cells having a matching equals(..) result.


hashCodeIgnoreMvcc

public static int hashCodeIgnoreMvcc(Cell cell)
Returns a hash code that is always the same for two Cells having a matching equals(..) result. Note : Ignore mvcc while calculating the hashcode

Parameters:
cell -
Returns:
hashCode

areKeyLengthsEqual

public static boolean areKeyLengthsEqual(Cell a,
                                         Cell b)
lengths


areRowLengthsEqual

public static boolean areRowLengthsEqual(Cell a,
                                         Cell b)

equalsIgnoreMvccVersion

public static boolean equalsIgnoreMvccVersion(Cell a,
                                              Cell b)
special case for KeyValue.equals



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