Package org.apache.hadoop.hbase
Class MetaCellComparator
java.lang.Object
org.apache.hadoop.hbase.CellComparatorImpl
org.apache.hadoop.hbase.MetaCellComparator
- All Implemented Interfaces:
Serializable,Comparator<Cell>,CellComparator
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceprivate static interfaceprivate static interface -
Field Summary
FieldsFields inherited from class org.apache.hadoop.hbase.CellComparatorImpl
COMPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompare cells.private static intcompareBBAndBytesRows(ByteBuffer left, int loffset, int llength, byte[] right, int roffset, int rlength) private static intcompareBBRows(ByteBuffer left, int loffset, int llength, ByteBuffer right, int roffset, int rlength) private static intcompareBytesRows(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength) intcompareRows(byte[] leftRow, byte[] rightRow) Compares two row bytesintcompareRows(ByteBuffer row, Cell cell) Lexicographically compare two rowsprivate 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) intcompareRows(Cell left, byte[] right, int roffset, int rlength) Compares the row part of the cell with a simple plain byte[] like the stopRow in Scan.intcompareRows(Cell left, Cell right) Compares the rows of the left and right cell.Return a dumbed-down, fast comparator for hbase2 base-type, theByteBufferKeyValue.Methods inherited from class org.apache.hadoop.hbase.CellComparatorImpl
compare, compareColumns, compareFamilies, compareFamilies, compareFamilies, compareFamilies, compareFamilies, compareQualifiers, compareQualifiers, compareQualifiers, compareQualifiers, compareQualifiers, compareRows, compareTimestamps, compareTimestamps, compareWithoutRow, getCellComparator, getCellComparatorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
META_COMPARATOR
-
-
Constructor Details
-
MetaCellComparator
public MetaCellComparator()
-
-
Method Details
-
compareRows
Description copied from class:CellComparatorImplCompares 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:
compareRowsin interfaceCellComparator- Overrides:
compareRowsin classCellComparatorImpl- Parameters:
left- the left hand side cellright- the right hand side cell- Returns:
- 0 if both cells are equal, 1 if left cell is bigger than right, -1 otherwise
-
compareRows
Description copied from class:CellComparatorImplCompares 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_COMPARATORshould 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:
compareRowsin interfaceCellComparator- Overrides:
compareRowsin classCellComparatorImpl- Parameters:
left- the cellright- the byte[] representing the row to be compared withroffset- 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
Description copied from interface:CellComparatorCompares two row bytes- Parameters:
leftRow- the byte array of the left rowrightRow- 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
Description copied from interface:CellComparatorCompare cells.- Specified by:
comparein interfaceCellComparator- Overrides:
comparein classCellComparatorImplignoreSequenceid- 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
Description copied from interface:CellComparatorLexicographically 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:CellComparatorReturn a dumbed-down, fast comparator for hbase2 base-type, theByteBufferKeyValue. 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:
getSimpleComparatorin interfaceCellComparator- Overrides:
getSimpleComparatorin classCellComparatorImpl
-