@InterfaceAudience.Private public class PrefixTreeArraySearcher extends PrefixTreeArrayReversibleScanner implements CellSearcher
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.afterLast, beforeFirst, blockMeta, currentCellIndex, currentRowNode, familyReader, mvccVersionDecoder, nubCellsRemain, qualifierReader, rowNodes, rowNodeStackIndex, tagsReader, timestampDecoderabsoluteValueOffset, block, DEFAULT_TYPE, familyBuffer, familyLength, familyOffset, includeMvccVersion, mvccVersion, qualifierBuffer, qualifierLength, qualifierOffset, rowBuffer, rowLength, tagsBuffer, tagsLength, tagsOffset, timestamp, type, TYPES, valueLength| Constructor and Description |
|---|
PrefixTreeArraySearcher(PrefixTreeBlockMeta blockMeta,
int rowTreeDepth,
int rowBufferLength,
int qualifierBufferLength,
int tagsBufferLength)
construct
|
| Modifier and Type | Method and Description |
|---|---|
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.reseek(org.apache.hadoop.hbase.Cell) |
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.
|
descendToLastRowFromCurrentPosition, isDirectlyAfterNub, positionAtLastCell, positionAtLastRow, previous, previousRowadvance, appendCurrentTokenToRowBuffer, appendToRowBuffer, areBuffersBigEnough, current, discardCurrentRowNode, followCurrentFan, followFan, followFirstFan, followLastFan, followNextFan, followPreviousFan, getBlockMeta, getMaxRowTreeStackNodes, getQualifierBufferLength, getRowBufferLength, getTagBufferLength, getTreeBytes, hashCode, hasOccurrences, initFirstNode, initOnBlock, isAfterLast, isBeforeFirst, isBranch, isFirstCellInRow, isLastCellInRow, isLeaf, isNub, isOutOfBounds, markAfterLast, markBeforeFirst, nextRow, nextRowInternal, popFromRowBuffer, populateFamily, populateFirstNonRowFields, populateLastNonRowFields, populateMvccVersion, populateNonRowFields, populateNonRowFieldsAndCompareTo, populatePreviousNonRowFields, populateQualifier, populateTag, populateTimestamp, populateType, populateValueOffsets, positionAtFirstCell, reInitFirstNode, releaseBlockReference, resetToBeforeFirstEntry, toStringcompareTo, getFamily, getFamilyArray, getFamilyLength, getFamilyOffset, getKeyValueString, getMvccVersion, getQualifier, getQualifierArray, getQualifierLength, getQualifierOffset, getRow, getRowArray, getRowLength, getRowOffset, getSequenceId, getTagsArray, getTagsLength, getTagsOffset, getTimestamp, getTypeByte, getValue, getValueArray, getValueLength, getValueOffset, setSequenceIdclone, finalize, getClass, notify, notifyAll, wait, wait, waitresetToBeforeFirstEntryprevious, previousRowadvance, currentpublic PrefixTreeArraySearcher(PrefixTreeBlockMeta blockMeta, int rowTreeDepth, int rowBufferLength, int qualifierBufferLength, int tagsBufferLength)
public boolean positionAt(Cell key)
positionAt in interface CellSearcherkey - position the CellScanner exactly on this keypublic CellScannerPosition positionAtOrBefore(Cell key)
CellSearcherSame as positionAt(..), but go to the extra effort of finding the previous key if there's no exact match.
positionAtOrBefore in interface CellSearcherkey - position the CellScanner on this key or the closest cell beforepublic CellScannerPosition positionAtOrAfter(Cell key)
positionAtOrAfter in interface CellSearcherkey - position the CellScanner on this key or the closest cell afterpublic boolean seekForwardTo(Cell key)
CellSearcher
Note: Added for backwards compatibility with
KeyValueScanner.reseek(org.apache.hadoop.hbase.Cell)
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 CellSearcherkey - position the CellScanner exactly on this keypublic CellScannerPosition seekForwardToOrBefore(Cell key)
CellSearcherSame as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match.
seekForwardToOrBefore in interface CellSearcherpublic CellScannerPosition seekForwardToOrAfter(Cell key)
CellSearcherSame as seekForwardTo(..), but go to the extra effort of finding the next key if there's no exact match.
seekForwardToOrAfter in interface CellSearcherpublic void positionAfterLastCell()
positionAfterLastCell in interface CellSearcherpublic boolean equals(Object obj)
equals in class PrefixTreeArrayReversibleScannerprotected boolean currentPositionIsAfter(Cell cell)
protected CellScannerPosition positionAtQualifierTimestamp(Cell key, boolean beforeOnMiss)
protected boolean rowMatchesAfterCurrentPosition(Cell key)
key - Cell being searched forprotected 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)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.