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
Modifier and TypeClassDescriptionprivate static interface
private static interface
private static interface
-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.CellComparatorImpl
COMPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Compare cells.private static int
compareBBAndBytesRows
(ByteBuffer left, int loffset, int llength, byte[] right, int roffset, int rlength) private static int
compareBBRows
(ByteBuffer left, int loffset, int llength, ByteBuffer right, int roffset, int rlength) private static int
compareBytesRows
(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength) int
compareRows
(byte[] leftRow, byte[] rightRow) Compares two row bytesint
compareRows
(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) int
compareRows
(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.int
compareRows
(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, getCellComparator
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, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
META_COMPARATOR
-
-
Constructor Details
-
MetaCellComparator
public MetaCellComparator()
-
-
Method Details
-
compareRows
Description copied from class:CellComparatorImpl
Compares 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:
compareRows
in interfaceCellComparator
- Overrides:
compareRows
in 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:CellComparatorImpl
Compares 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_COMPARATOR
should 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:
compareRows
in interfaceCellComparator
- Overrides:
compareRows
in 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:CellComparator
Compares 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:CellComparator
Compare cells.- Specified by:
compare
in interfaceCellComparator
- Overrides:
compare
in classCellComparatorImpl
ignoreSequenceid
- 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:CellComparator
Lexicographically 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:CellComparator
Return 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:
getSimpleComparator
in interfaceCellComparator
- Overrides:
getSimpleComparator
in classCellComparatorImpl
-