HBASE-14539 Slight improvement of StoreScanner.optimize.

This commit is contained in:
Lars Hofhansl 2015-10-02 20:23:03 -07:00
parent 44b8809726
commit 3b8039ed0f
1 changed files with 6 additions and 7 deletions

View File

@ -676,16 +676,13 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
* (see HBASE-13109) * (see HBASE-13109)
*/ */
private ScanQueryMatcher.MatchCode optimize(ScanQueryMatcher.MatchCode qcode, Cell cell) { private ScanQueryMatcher.MatchCode optimize(ScanQueryMatcher.MatchCode qcode, Cell cell) {
Cell nextIndexedKey = getNextIndexedKey();
if (nextIndexedKey == null || nextIndexedKey == HConstants.NO_NEXT_INDEXED_KEY ||
store == null) {
return qcode;
}
switch(qcode) { switch(qcode) {
case INCLUDE_AND_SEEK_NEXT_COL: case INCLUDE_AND_SEEK_NEXT_COL:
case SEEK_NEXT_COL: case SEEK_NEXT_COL:
{ {
if (matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0) { Cell nextIndexedKey = getNextIndexedKey();
if (nextIndexedKey != null && nextIndexedKey != HConstants.NO_NEXT_INDEXED_KEY
&& matcher.compareKeyForNextColumn(nextIndexedKey, cell) >= 0) {
return qcode == MatchCode.SEEK_NEXT_COL ? MatchCode.SKIP : MatchCode.INCLUDE; return qcode == MatchCode.SEEK_NEXT_COL ? MatchCode.SKIP : MatchCode.INCLUDE;
} }
break; break;
@ -693,7 +690,9 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
case INCLUDE_AND_SEEK_NEXT_ROW: case INCLUDE_AND_SEEK_NEXT_ROW:
case SEEK_NEXT_ROW: case SEEK_NEXT_ROW:
{ {
if (matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0) { Cell nextIndexedKey = getNextIndexedKey();
if (nextIndexedKey != null && nextIndexedKey != HConstants.NO_NEXT_INDEXED_KEY
&& matcher.compareKeyForNextRow(nextIndexedKey, cell) >= 0) {
return qcode == MatchCode.SEEK_NEXT_ROW ? MatchCode.SKIP : MatchCode.INCLUDE; return qcode == MatchCode.SEEK_NEXT_ROW ? MatchCode.SKIP : MatchCode.INCLUDE;
} }
break; break;