|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeCell
org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeArrayScanner
org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeArrayReversibleScanner
org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeArraySearcher
@InterfaceAudience.Private public class PrefixTreeArraySearcher
Searcher extends the capabilities of the Scanner + ReversibleScanner to add the ability to position itself on a requested Cell without scanning through cells before it. The PrefixTree is set up to be a Trie of rows, so finding a particular row is extremely cheap.
Once it finds the row, it does a binary search through the cells inside the row, which is not as fast as the trie search, but faster than iterating through every cell like existing block formats do. For this reason, this implementation is targeted towards schemas where rows are narrow enough to have several or many per block, and where you are generally looking for the entire row or the first cell. It will still be fast for wide rows or point queries, but could be improved upon.
Field Summary |
---|
Fields inherited from class org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeArrayScanner |
---|
afterLast, beforeFirst, blockMeta, currentCellIndex, currentRowNode, familyReader, mvccVersionDecoder, nubCellsRemain, qualifierReader, rowNodes, rowNodeStackIndex, tagsReader, timestampDecoder |
Fields inherited from class org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeCell |
---|
absoluteValueOffset, block, DEFAULT_TYPE, familyBuffer, familyLength, familyOffset, includeMvccVersion, mvccVersion, qualifierBuffer, qualifierLength, qualifierOffset, rowBuffer, rowLength, tagsBuffer, tagsLength, tagsOffset, timestamp, type, TYPES, valueLength |
Constructor Summary | |
---|---|
PrefixTreeArraySearcher(PrefixTreeBlockMeta blockMeta,
int rowTreeDepth,
int rowBufferLength,
int qualifierBufferLength,
int tagsBufferLength)
construct |
Method Summary | |
---|---|
protected int |
compareToCurrentToken(Cell key)
Compare only the bytes within the window of the current token |
protected boolean |
currentPositionIsAfter(Cell cell)
internal methods |
boolean |
equals(Object obj)
Object methods |
protected CellScannerPosition |
fixRowFanMissForward(int fanInsertionPoint)
|
protected CellScannerPosition |
fixRowFanMissReverse(int fanInsertionPoint)
complete seek when fan mismatch |
protected CellScannerPosition |
fixRowTokenMissForward(int searcherIsAfterInputKey)
|
protected CellScannerPosition |
fixRowTokenMissReverse(int searcherIsAfterInputKey)
|
protected void |
followLastFansUntilExhausted()
|
void |
positionAfterLastCell()
The content of the buffers doesn't matter here, only that afterLast=true and beforeFirst=false |
boolean |
positionAt(Cell key)
CellSearcher methods |
CellScannerPosition |
positionAtOrAfter(Cell key)
Identical workflow as positionAtOrBefore, but split them to avoid having ~10 extra if-statements. |
CellScannerPosition |
positionAtOrBefore(Cell key)
Same as positionAt(..), but go to the extra effort of finding the previous key if there's no exact match. |
protected CellScannerPosition |
positionAtQualifierTimestamp(Cell key,
boolean beforeOnMiss)
|
protected boolean |
rowMatchesAfterCurrentPosition(Cell key)
compare this.row to key.row but starting at the current rowLength |
boolean |
seekForwardTo(Cell key)
Note: Added for backwards compatibility with KeyValueScanner
Look for the key, but only look after the current position. |
CellScannerPosition |
seekForwardToOrAfter(Cell key)
Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match. |
CellScannerPosition |
seekForwardToOrBefore(Cell key)
Same as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match. |
Methods inherited from class org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeArrayReversibleScanner |
---|
descendToLastRowFromCurrentPosition, isDirectlyAfterNub, positionAtLastCell, positionAtLastRow, previous, previousRow |
Methods inherited from class org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeCell |
---|
compareTo, getFamily, getFamilyArray, getFamilyLength, getFamilyOffset, getKeyValueString, getMvccVersion, getQualifier, getQualifierArray, getQualifierLength, getQualifierOffset, getRow, getRowArray, getRowLength, getRowOffset, getTagsArray, getTagsLength, getTagsLengthUnsigned, getTagsOffset, getTimestamp, getTypeByte, getValue, getValueArray, getValueLength, getValueOffset |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher |
---|
resetToBeforeFirstEntry |
Methods inherited from interface org.apache.hadoop.hbase.codec.prefixtree.scanner.ReversibleCellScanner |
---|
previous, previousRow |
Methods inherited from interface org.apache.hadoop.hbase.CellScanner |
---|
advance, current |
Constructor Detail |
---|
public PrefixTreeArraySearcher(PrefixTreeBlockMeta blockMeta, int rowTreeDepth, int rowBufferLength, int qualifierBufferLength, int tagsBufferLength)
Method Detail |
---|
public boolean positionAt(Cell key)
positionAt
in interface CellSearcher
key
- position the CellScanner exactly on this key
public CellScannerPosition positionAtOrBefore(Cell key)
CellSearcher
positionAtOrBefore
in interface CellSearcher
key
- position the CellScanner on this key or the closest cell before
public CellScannerPosition positionAtOrAfter(Cell key)
positionAtOrAfter
in interface CellSearcher
key
- position the CellScanner on this key or the closest cell after
public boolean seekForwardTo(Cell key)
CellSearcher
KeyValueScanner
Look for the key, but only look after the current position. Probably not needed for an
efficient tree implementation, but is important for implementations without random access such
as unencoded KeyValue blocks.
seekForwardTo
in interface CellSearcher
key
- position the CellScanner exactly on this key
public CellScannerPosition seekForwardToOrBefore(Cell key)
CellSearcher
seekForwardToOrBefore
in interface CellSearcher
public CellScannerPosition seekForwardToOrAfter(Cell key)
CellSearcher
seekForwardToOrAfter
in interface CellSearcher
public void positionAfterLastCell()
positionAfterLastCell
in interface CellSearcher
public boolean equals(Object obj)
equals
in class PrefixTreeArrayReversibleScanner
protected boolean currentPositionIsAfter(Cell cell)
protected CellScannerPosition positionAtQualifierTimestamp(Cell key, boolean beforeOnMiss)
protected boolean rowMatchesAfterCurrentPosition(Cell key)
key
- Cell being searched for
protected int compareToCurrentToken(Cell key)
key
-
protected void followLastFansUntilExhausted()
protected CellScannerPosition fixRowTokenMissReverse(int searcherIsAfterInputKey)
searcherIsAfterInputKey
- <0: input key is before the searcher's positionprotected CellScannerPosition fixRowTokenMissForward(int searcherIsAfterInputKey)
searcherIsAfterInputKey
- <0: input key is before the searcher's positionprotected CellScannerPosition fixRowFanMissReverse(int fanInsertionPoint)
protected CellScannerPosition fixRowFanMissForward(int fanInsertionPoint)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |