@InterfaceAudience.Private @InterfaceStability.Evolving public class CellComparator extends Object implements Comparator<Cell>, Serializable
-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 enoughModifier and Type | Class and Description |
---|---|
static class |
CellComparator.MetaCellComparator
|
Modifier and Type | Field and Description |
---|---|
static CellComparator |
COMPARATOR
Comparator for plain key/values; i.e.
|
static CellComparator |
META_COMPARATOR
|
Constructor and Description |
---|
CellComparator() |
Modifier and Type | Method and Description |
---|---|
int |
compare(Cell left,
byte[] key,
int offset,
int length)
Used when a cell needs to be compared with a key byte[] such as cases of
finding the index from the index block, bloom keys from the bloom blocks
This byte[] is expected to be serialized in the KeyValue serialization format
If the KeyValue (Cell's) serialization format changes this method cannot be used.
|
int |
compare(Cell a,
Cell b) |
static int |
compareColumns(Cell left,
Cell right)
Compares the family and qualifier part of the cell
|
static int |
compareFamilies(Cell left,
Cell right)
Compare the families of left and right cell
|
static int |
compareFamily(Cell cell,
ByteArrayComparable comparator)
Compare cell's column family against given comparator
|
int |
compareKeyBasedOnColHint(Cell nextIndexedCell,
Cell currentCell,
int foff,
int flen,
byte[] colHint,
int coff,
int clen,
long ts,
byte type)
Used to compare two cells based on the column hint provided.
|
int |
compareKeyIgnoresMvcc(Cell left,
Cell right)
Compares only the key portion of a cell.
|
static int |
compareQualifier(Cell cell,
ByteArrayComparable comparator)
Compare cell's qualifier against given comparator
|
static int |
compareQualifiers(Cell left,
byte[] right,
int rOffset,
int rLength) |
static int |
compareQualifiers(Cell left,
Cell right)
Compare the qualifiers part of the left and right cells.
|
static int |
compareRow(Cell cell,
ByteArrayComparable comparator)
Compare cell's row against given 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.
|
static int |
compareTimestamps(Cell left,
Cell right)
Compares cell's timestamps in DESCENDING order.
|
static int |
compareTimestamps(long ltimestamp,
long rtimestamp)
Compares timestamps in DESCENDING order.
|
static int |
compareValue(Cell cell,
ByteArrayComparable comparator)
Compare cell's value against given comparator
|
static int |
compareWithoutRow(Cell left,
Cell right) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final CellComparator COMPARATOR
public static final CellComparator META_COMPARATOR
public int compare(Cell a, Cell b)
compare
in interface Comparator<Cell>
public final int compareKeyIgnoresMvcc(Cell left, Cell right)
left
- right
- public final int compare(Cell left, byte[] key, int offset, int length)
left
- the cell to be comparedkey
- the serialized key part of a KeyValueoffset
- the offset in the key byte[]length
- the length of the key byte[]public static final int compareColumns(Cell left, Cell right)
left
- the left cellright
- the right cellpublic static final int compareFamilies(Cell left, Cell right)
left
- right
- public static final int compareQualifiers(Cell left, Cell right)
left
- right
- public static final int compareQualifiers(Cell left, byte[] right, int rOffset, int rLength)
public int compareRows(Cell left, Cell right)
left
- right
- public int compareRows(Cell left, byte[] right, int roffset, int rlength)
META_COMPARATOR
should be usedleft
- 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 static int compareTimestamps(Cell left, Cell right)
public final int compareKeyBasedOnColHint(Cell nextIndexedCell, Cell currentCell, int foff, int flen, byte[] colHint, int coff, int clen, long ts, byte type)
nextIndexedCell
- the next indexed cellcurrentCell
- the cell to be comparedfoff
- the family offset of the currentCellflen
- the family length of the currentCellcolHint
- the column hint provided - could be nullcoff
- the offset of the column hint if provided, if not offset of the currentCell's
qualifierclen
- the length of the column hint if provided, if not length of the currentCell's
qualifierts
- the timestamp to be seekedtype
- the type to be seekedpublic static int compareTimestamps(long ltimestamp, long rtimestamp)
public static int compareRow(Cell cell, ByteArrayComparable comparator)
cell
- comparator
- public static int compareFamily(Cell cell, ByteArrayComparable comparator)
cell
- comparator
- public static int compareQualifier(Cell cell, ByteArrayComparable comparator)
cell
- comparator
- public static int compareValue(Cell cell, ByteArrayComparable comparator)
cell
- comparator
- Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.