org.apache.hadoop.hbase
Class KeyValue.KVComparator
java.lang.Object
org.apache.hadoop.hbase.KeyValue.KVComparator
- All Implemented Interfaces:
- Comparator<KeyValue>
- Direct Known Subclasses:
- KeyValue.MetaComparator
- Enclosing class:
- KeyValue
public static class KeyValue.KVComparator
- extends Object
- implements Comparator<KeyValue>
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.RootKeyComparator
.
Method Summary |
protected Object |
clone()
|
int |
compare(KeyValue left,
KeyValue right)
|
int |
compareColumns(KeyValue left,
byte[] right,
int roffset,
int rlength,
int rfamilyoffset)
|
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.KVComparator |
getComparatorIgnoringTimestamps()
|
KeyValue.KVComparator |
getComparatorIgnoringType()
|
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. |
KeyValue.KVComparator
public KeyValue.KVComparator()
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.
compare
public int compare(KeyValue left,
KeyValue right)
- Specified by:
compare
in interface Comparator<KeyValue>
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
getComparatorIgnoringTimestamps
public KeyValue.KVComparator getComparatorIgnoringTimestamps()
- Returns:
- Comparator that ignores timestamps; useful counting versions.
getComparatorIgnoringType
public KeyValue.KVComparator getComparatorIgnoringType()
- Returns:
- Comparator that ignores key type; useful checking deletes
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.