@Override public boolean seekToPreviousRow(Cell seekKey) throws IOException { if (current == null) { return false; } heap.add(current); current = null; KeyValueScanner scanner; while ((scanner = heap.poll()) != null) { Cell topKey = scanner.peek(); if (comparator.getComparator().compareRows(topKey, seekKey) < 0) { // Row of Top KeyValue is before Seek row. heap.add(scanner); current = pollRealKV(); return current != null; } if (!scanner.seekToPreviousRow(seekKey)) { this.scannersForDelayedClose.add(scanner); } else { heap.add(scanner); } } // Heap is returning empty, scanner is done return false; }
@Override public boolean backwardSeek(Cell seekKey) throws IOException { if (current == null) { return false; } heap.add(current); current = null; KeyValueScanner scanner; while ((scanner = heap.poll()) != null) { Cell topKey = scanner.peek(); if ((CellUtil.matchingRows(seekKey, topKey) && comparator .getComparator().compare(seekKey, topKey) <= 0) || comparator.getComparator().compareRows(seekKey, topKey) > 0) { heap.add(scanner); current = pollRealKV(); return current != null; } if (!scanner.backwardSeek(seekKey)) { this.scannersForDelayedClose.add(scanner); } else { heap.add(scanner); } } return false; }
while (scanner != null) { Cell topKey = scanner.peek(); if (comparator.getComparator().compare(seekKey, topKey) <= 0) {
while ((scanner = heap.poll()) != null) { KeyValue topKey = scanner.peek(); if (comparator.getComparator().compare(seekKey, topKey) <= 0) {
while ((scanner = heap.poll()) != null) { Cell topKey = scanner.peek(); if (comparator.getComparator().compare(seekKey, topKey) <= 0) {
@Override public boolean seekToPreviousRow(Cell seekKey) throws IOException { if (current == null) { return false; } heap.add(current); current = null; KeyValueScanner scanner; while ((scanner = heap.poll()) != null) { Cell topKey = scanner.peek(); if (comparator.getComparator().compareRows(topKey.getRowArray(), topKey.getRowOffset(), topKey.getRowLength(), seekKey.getRowArray(), seekKey.getRowOffset(), seekKey.getRowLength()) < 0) { // Row of Top KeyValue is before Seek row. heap.add(scanner); current = pollRealKV(); return current != null; } if (!scanner.seekToPreviousRow(seekKey)) { scanner.close(); } else { heap.add(scanner); } } // Heap is returning empty, scanner is done return false; }
@Override public boolean backwardSeek(Cell seekKey) throws IOException { if (current == null) { return false; } heap.add(current); current = null; KeyValueScanner scanner; while ((scanner = heap.poll()) != null) { Cell topKey = scanner.peek(); if ((CellUtil.matchingRow(seekKey, topKey) && comparator .getComparator().compare(seekKey, topKey) <= 0) || comparator.getComparator().compareRows(seekKey, topKey) > 0) { heap.add(scanner); current = pollRealKV(); return current != null; } if (!scanner.backwardSeek(seekKey)) { scanner.close(); } else { heap.add(scanner); } } return false; }