org.apache.hadoop.hbase
Class KeyValue.KVComparator

java.lang.Object
  extended by org.apache.hadoop.hbase.KeyValue.KVComparator
All Implemented Interfaces:
Comparator<Cell>
Direct Known Subclasses:
KeyValue.MetaComparator
Enclosing class:
KeyValue

public static class KeyValue.KVComparator
extends Object
implements Comparator<Cell>

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. Hosts a KeyValue.MetaKeyComparator.


Constructor Summary
KeyValue.KVComparator()
           
 
Method Summary
protected  Object clone()
           
 int compare(Cell left, Cell right)
          Compares the Key of a cell -- with fields being more significant in this order: rowkey, colfam/qual, timestamp, type, mvcc
 int compareColumns(KeyValue left, byte[] right, int roffset, int rlength, int rfamilyoffset)
           
protected  int compareRowKey(Cell left, Cell right)
           
 int compareRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
           
 int compareRows(KeyValue left, byte[] row)
           
 int compareRows(KeyValue left, KeyValue right)
           
 int compareRows(KeyValue left, short lrowlength, KeyValue right, short rrowlength)
           
 int compareTimestamps(KeyValue left, KeyValue right)
           
 KeyValue.KeyComparator getRawComparator()
           
 boolean matchingRowColumn(KeyValue left, KeyValue right)
          Compares the row and column of two keyvalues for equality
 boolean matchingRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength)
           
 boolean matchingRows(KeyValue left, byte[] right)
           
 boolean matchingRows(KeyValue left, KeyValue right)
          Compares the row of two keyvalues for equality
 boolean matchingRows(KeyValue left, short lrowlength, KeyValue right, short rrowlength)
           
 boolean matchingRowsGreaterTimestamp(KeyValue left, KeyValue right)
          Compares the row and timestamp of two keys Was called matchesWithoutColumn in HStoreKey.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

KeyValue.KVComparator

public KeyValue.KVComparator()
Method Detail

getRawComparator

public KeyValue.KeyComparator getRawComparator()
Returns:
RawComparator that can compare the Key portion of a KeyValue. Used in hfile where indices are the Key portion of a KeyValue.

compareRowKey

protected int compareRowKey(Cell left,
                            Cell right)

compare

public int compare(Cell left,
                   Cell right)
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(KeyValue left,
                             KeyValue right)

compareRows

public int compareRows(KeyValue left,
                       KeyValue right)
Parameters:
left -
right -
Returns:
Result comparing rows.

compareRows

public int compareRows(KeyValue left,
                       short lrowlength,
                       KeyValue right,
                       short rrowlength)
Parameters:
left -
lrowlength - Length of left row.
right -
rrowlength - Length of right row.
Returns:
Result comparing rows.

compareRows

public int compareRows(KeyValue left,
                       byte[] row)
Parameters:
left -
row - - row key (arbitrary byte array)
Returns:
RawComparator

compareRows

public int compareRows(byte[] left,
                       int loffset,
                       int llength,
                       byte[] right,
                       int roffset,
                       int rlength)

compareColumns

public int compareColumns(KeyValue left,
                          byte[] right,
                          int roffset,
                          int rlength,
                          int rfamilyoffset)

matchingRowColumn

public boolean matchingRowColumn(KeyValue left,
                                 KeyValue right)
Compares the row and column of two keyvalues for equality

Parameters:
left -
right -
Returns:
True if same row and column.

matchingRows

public boolean matchingRows(KeyValue left,
                            byte[] right)
Parameters:
left -
right -
Returns:
True if rows match.

matchingRows

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

Parameters:
left -
right -
Returns:
True if rows match.

matchingRows

public boolean matchingRows(KeyValue left,
                            short lrowlength,
                            KeyValue right,
                            short rrowlength)
Parameters:
left -
lrowlength -
right -
rrowlength -
Returns:
True if rows match.

matchingRows

public boolean matchingRows(byte[] left,
                            int loffset,
                            int llength,
                            byte[] right,
                            int roffset,
                            int rlength)

matchingRowsGreaterTimestamp

public boolean matchingRowsGreaterTimestamp(KeyValue left,
                                            KeyValue right)
Compares the row and timestamp of two keys Was called matchesWithoutColumn in HStoreKey.

Parameters:
right - Key to compare against.
Returns:
True if same row and timestamp is greater than the timestamp in right

clone

protected Object clone()
                throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.