@InterfaceAudience.Private @InterfaceStability.Evolving public class CellComparatorImpl extends Object implements CellComparator
-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-.
While using this comparator for {compareRows(Cell, Cell)
et al, the hbase:meta cells
format should be taken into consideration, for which the instance of this comparator
should be used. In all other cases the static APIs in this comparator would be enough
HOT methods. We spend a good portion of CPU comparing. Anything that makes the compare
faster will likely manifest at the macro level. See also
BBKVComparator
. Use it when mostly ByteBufferKeyValue
s.
Modifier and Type | Class and Description |
---|---|
static class |
CellComparatorImpl.MetaCellComparator
|
Modifier and Type | Field and Description |
---|---|
static CellComparatorImpl |
COMPARATOR
Comparator for plain key/values; i.e.
|
static CellComparatorImpl |
META_COMPARATOR
|
Constructor and Description |
---|
CellComparatorImpl() |
Modifier and Type | Method and Description |
---|---|
int |
compare(Cell a,
Cell b)
Lexographically compares two cells.
|
int |
compare(Cell a,
Cell b,
boolean ignoreSequenceid)
Compare cells.
|
int |
compareColumns(Cell left,
Cell right)
Compares the family and qualifier part of the cell
|
int |
compareFamilies(Cell left,
Cell right)
Compare the families of left and right cell
|
int |
compareQualifiers(Cell left,
Cell right)
Compare the qualifiers part of the left and right cells.
|
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.
|
int |
compareTimestamps(Cell left,
Cell right)
Compares cell's timestamps in DESCENDING order.
|
int |
compareTimestamps(long ltimestamp,
long rtimestamp)
Compares cell's timestamps in DESCENDING order.
|
int |
compareWithoutRow(Cell left,
Cell right)
Lexographically compares the two cells excluding the row part.
|
Comparator |
getSimpleComparator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInstance
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final CellComparatorImpl COMPARATOR
public static final CellComparatorImpl META_COMPARATOR
public final int compare(Cell a, Cell b)
CellComparator
compare
in interface Comparator<Cell>
compare
in interface CellComparator
a
- the left hand side cellb
- the right hand side cellpublic int compare(Cell a, Cell b, boolean ignoreSequenceid)
CellComparator
compare
in interface CellComparator
ignoreSequenceid
- True if we are to compare the key portion only and ignore
the sequenceid. Set to false to compare key and consider sequenceid.public final int compareColumns(Cell left, Cell right)
public final int compareFamilies(Cell left, Cell right)
compareFamilies
in interface CellComparator
left
- the left hand side cellright
- the right hand side cellpublic final int compareQualifiers(Cell left, Cell right)
compareQualifiers
in interface CellComparator
left
- the left hand side cellright
- the right hand side cellpublic int compareRows(Cell left, Cell right)
compareRows
in interface CellComparator
left
- the left hand side cellright
- the right hand side cellpublic int compareRows(Cell left, byte[] right, int roffset, int rlength)
META_COMPARATOR
should be usedcompareRows
in interface CellComparator
left
- the cell to be comparedright
- the kv serialized byte[] to be compared withroffset
- the offset in the byte[]rlength
- the length in the byte[]public final int compareWithoutRow(Cell left, Cell right)
CellComparator
compareWithoutRow
in interface CellComparator
left
- the left hand side cellright
- the right hand side cellpublic int compareTimestamps(Cell left, Cell right)
CellComparator
compareTimestamps
in interface CellComparator
left
- the left hand side cellright
- the right hand side cellpublic int compareTimestamps(long ltimestamp, long rtimestamp)
CellComparator
compareTimestamps
in interface CellComparator
ltimestamp
- the left cell's timestamprtimestamp
- the right cell's timestamppublic Comparator getSimpleComparator()
getSimpleComparator
in interface CellComparator
ByteBufferKeyValue
.
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.Copyright © 2007–2019 Cloudera. All rights reserved.