@Override public boolean seekToPreviousRow(Cell key) throws IOException { return delegate.seekToPreviousRow(key); }
@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 Cell next() throws IOException { if (this.current == null) { return null; } Cell kvReturn = this.current.next(); Cell kvNext = this.current.peek(); if (kvNext == null || this.comparator.kvComparator.compareRows(kvNext, kvReturn) > 0) { if (this.current.seekToPreviousRow(kvReturn)) { this.heap.add(this.current); } else { this.scannersForDelayedClose.add(this.current); } this.current = null; this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); if (topScanner != null && this.comparator.compare(this.current, topScanner) > 0) { this.heap.add(this.current); this.current = null; this.current = pollRealKV(); } } return kvReturn; }
assertTrue(scanner.seekToPreviousRow(KeyValueUtil .createFirstOnRow(ROWS[seekRowNum]))); expectedKey = makeKV(seekRowNum - 1, 0); assertFalse(scanner.seekToPreviousRow(makeKV(0, 0))); assertEquals(null, scanner.peek());
res = false; for (KeyValueScanner scanner : scanners) { res |= scanner.seekToPreviousRow(KeyValueUtil.createFirstOnRow(ROWS[seekRowNum]));
@Override public boolean seekToPreviousRow(Cell key) throws IOException { return delegate.seekToPreviousRow(key); }
@Override public Cell next() throws IOException { if (this.current == null) { return null; } Cell kvReturn = this.current.next(); Cell kvNext = this.current.peek(); if (kvNext == null || this.comparator.kvComparator.compareRows(kvNext, kvReturn) > 0) { if (this.current.seekToPreviousRow(kvReturn)) { this.heap.add(this.current); } else { this.current.close(); } this.current = null; this.current = pollRealKV(); } else { KeyValueScanner topScanner = this.heap.peek(); if (topScanner != null && this.comparator.compare(this.current, topScanner) > 0) { this.heap.add(this.current); this.current = null; this.current = pollRealKV(); } } return kvReturn; }
@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; }
assertTrue(scanner.seekToPreviousRow(KeyValueUtil .createFirstOnRow(ROWS[seekRowNum]))); expectedKey = makeKV(seekRowNum - 1, 0); assertFalse(scanner.seekToPreviousRow(makeKV(0, 0))); assertEquals(null, scanner.peek());
res = false; for (KeyValueScanner scanner : scanners) { res |= scanner.seekToPreviousRow(KeyValueUtil.createFirstOnRow(ROWS[seekRowNum]));