Cell lastKey = reader.getLastKey().get();
@Override public Optional<Cell> getLastKey() { if (top) { return super.getLastKey(); } // Get a scanner that caches the block and that uses pread. HFileScanner scanner = getScanner(true, true); try { if (scanner.seekBefore(this.splitCell)) { return Optional.ofNullable(scanner.getKey()); } } catch (IOException e) { LOG.warn("Failed seekBefore " + Bytes.toStringBinary(this.splitkey), e); } finally { if (scanner != null) { scanner.close(); } } return Optional.empty(); }
lastKey = reader.getLastKey(); comparator = reader.getComparator();
/** * Checks whether the given scan rowkey range overlaps with the current storefile's * @param scan the scan specification. Used to determine the rowkey range. * @return true if there is overlap, false otherwise */ public boolean passesKeyRangeFilter(Scan scan) { Optional<Cell> firstKeyKV = this.getFirstKey(); Optional<Cell> lastKeyKV = this.getLastKey(); if (!firstKeyKV.isPresent() || !lastKeyKV.isPresent()) { // the file is empty return false; } if (Bytes.equals(scan.getStartRow(), HConstants.EMPTY_START_ROW) && Bytes.equals(scan.getStopRow(), HConstants.EMPTY_END_ROW)) { return true; } byte[] smallestScanRow = scan.isReversed() ? scan.getStopRow() : scan.getStartRow(); byte[] largestScanRow = scan.isReversed() ? scan.getStartRow() : scan.getStopRow(); boolean nonOverLapping = (getComparator() .compareRows(firstKeyKV.get(), largestScanRow, 0, largestScanRow.length) > 0 && !Bytes.equals(scan.isReversed() ? scan.getStartRow() : scan.getStopRow(), HConstants.EMPTY_END_ROW)) || getComparator().compareRows(lastKeyKV.get(), smallestScanRow, 0, smallestScanRow.length) < 0; return !nonOverLapping; }
byte [] finalRow = CellUtil.cloneRow(reader.getLastKey().get()); hsf.closeStoreFile(true);
byte [] finalRow = CellUtil.cloneRow(reader.getLastKey().get()); hsf.closeStoreFile(true);