@Override public Cell getNextCellHint(Cell currentKV) { // skip to the next range's start row return PrivateCellUtil.createFirstOnRow(range.startRow, 0, (short) range.startRow.length); }
public static Cell createFirstOnRow(final byte[] row, final byte[] family, final byte[] col) { return createFirstOnRow(row, 0, (short) row.length, family, 0, (byte) family.length, col, 0, col.length); }
public static Cell createFirstOnRow(final byte[] row) { return createFirstOnRow(row, 0, (short) row.length); }
@Override public Cell getNextIndexedKey() { // Fake block boundaries by having index of next block change as we go through scan. return PrivateCellUtil .createFirstOnRow(CELL_WITH_VERSIONS[CELL_WITH_VERSIONS_BLOCK2_BOUNDARY]); } }
@Override public Cell getNextIndexedKey() { // Fake block boundaries by having index of next block change as we go through scan. return count.get() > CELL_GRID_BLOCK4_BOUNDARY? PrivateCellUtil.createFirstOnRow(CELL_GRID[CELL_GRID_BLOCK5_BOUNDARY]): count.get() > CELL_GRID_BLOCK3_BOUNDARY? PrivateCellUtil.createFirstOnRow(CELL_GRID[CELL_GRID_BLOCK4_BOUNDARY]): count.get() > CELL_GRID_BLOCK2_BOUNDARY? PrivateCellUtil.createFirstOnRow(CELL_GRID[CELL_GRID_BLOCK3_BOUNDARY]): PrivateCellUtil.createFirstOnRow(CELL_GRID[CELL_GRID_BLOCK2_BOUNDARY]); } }
@Override public void beforeShipped() throws IOException { if (this.currentRow != null) { this.currentRow = PrivateCellUtil.createFirstOnRow(CellUtil.copyRow(this.currentRow)); } if (columns != null) { columns.beforeShipped(); } }
@Override public Cell getNextCellHint(Cell currentCell) { boolean result = tracker.updateTracker(currentCell); if (result == false) { done = true; return null; } byte[] nextRowKey = tracker.nextRow(); return PrivateCellUtil.createFirstOnRow(nextRowKey, 0, (short) nextRowKey.length); }
@Override public boolean seekToLastRow() throws IOException { Optional<byte[]> lastRow = reader.getLastRowKey(); if (!lastRow.isPresent()) { return false; } Cell seekKey = PrivateCellUtil.createFirstOnRow(lastRow.get()); if (seek(seekKey)) { return true; } else { return seekToPreviousRow(seekKey); } }
@Override public synchronized boolean reseek(byte[] row) throws IOException { if (row == null) { throw new IllegalArgumentException("Row cannot be null."); } boolean result = false; startRegionOperation(); Cell kv = PrivateCellUtil.createFirstOnRow(row, 0, (short) row.length); try { // use request seek to make use of the lazy seek option. See HBASE-5520 result = this.storeHeap.requestSeek(kv, true, true); if (this.joinedHeap != null) { result = this.joinedHeap.requestSeek(kv, true, true) || result; } } finally { closeRegionOperation(); } return result; }
private void writeResult(ImmutableBytesWritable key, Result result, Context context) throws IOException, InterruptedException { Put put = null; Delete delete = null; if (LOG.isTraceEnabled()) { LOG.trace("Considering the row." + Bytes.toString(key.get(), key.getOffset(), key.getLength())); } if (filter == null || !filter.filterRowKey(PrivateCellUtil.createFirstOnRow(key.get(), key.getOffset(), (short) key.getLength()))) { processKV(key, result, context, put, delete); } }
Cell key = cell; do { Cell firstKeyOnRow = PrivateCellUtil.createFirstOnRow(key); SortedSet<Cell> cellHead = segment.headSet(firstKeyOnRow); Cell lastCellBeforeRow = cellHead.isEmpty() ? null : cellHead.last(); return false; Cell firstKeyOnPreviousRow = PrivateCellUtil.createFirstOnRow(lastCellBeforeRow); this.stopSkippingKVsIfNextRow = true; this.stopSkippingKVsRow = firstKeyOnPreviousRow;
/** * @param row The current table row key. * @param value The columns. * @param context The current context. * @throws IOException When something is broken with the data. */ @Override public void map(ImmutableBytesWritable row, Result value, Context context) throws IOException { try { if (LOG.isTraceEnabled()) { LOG.trace("Considering the row." + Bytes.toString(row.get(), row.getOffset(), row.getLength())); } if (filter == null || !filter.filterRowKey( PrivateCellUtil.createFirstOnRow(row.get(), row.getOffset(), (short) row.getLength()))) { for (Cell kv : value.rawCells()) { kv = filterKv(filter, kv); // skip if we filtered it out if (kv == null) continue; Cell ret = convertKv(kv, cfRenameMap); context.write(new CellWritableComparable(ret), ret); } } } catch (InterruptedException e) { LOG.error("Interrupted while emitting Cell", e); Thread.currentThread().interrupt(); } }
/** * @param row The current table row key. * @param value The columns. * @param context The current context. * @throws IOException When something is broken with the data. */ @Override public void map(ImmutableBytesWritable row, Result value, Context context) throws IOException { try { if (LOG.isTraceEnabled()) { LOG.trace("Considering the row." + Bytes.toString(row.get(), row.getOffset(), row.getLength())); } if (filter == null || !filter.filterRowKey(PrivateCellUtil.createFirstOnRow(row.get(), row.getOffset(), (short) row.getLength()))) { for (Cell kv : value.rawCells()) { kv = filterKv(filter, kv); // skip if we filtered it out if (kv == null) continue; context.write(row, new MapReduceExtendedCell(convertKv(kv, cfRenameMap))); } } } catch (InterruptedException e) { LOG.error("Interrupted while emitting Cell", e); Thread.currentThread().interrupt(); } }
@Override protected boolean nextRow(ScannerContext scannerContext, Cell curRowCell) throws IOException { assert super.joinedContinuationRow == null : "Trying to go to next row during joinedHeap read."; this.storeHeap.seekToPreviousRow(PrivateCellUtil.createFirstOnRow(curRowCell)); resetFilters(); // Calling the hook in CP which allows it to do a fast forward if (this.region.getCoprocessorHost() != null) { return this.region.getCoprocessorHost().postScannerFilterRow(this, curRowCell); } return true; }
Cell key = originalKey; do { Cell seekKey = PrivateCellUtil.createFirstOnRow(key); if (seekCount != null) seekCount.increment(); if (!hfs.seekBefore(seekKey)) { Cell firstKeyOfPreviousRow = PrivateCellUtil.createFirstOnRow(curCell);
/** * Seek the scanner at the first KeyValue of last row * * @return true if scanner has values left, false if the underlying data is empty */ @Override public boolean seekToLastRow() throws IOException { if (closed) { return false; } Cell higherCell = segment.isEmpty() ? null : segment.last(); if (higherCell == null) { return false; } Cell firstCellOnLastRow = PrivateCellUtil.createFirstOnRow(higherCell); if (seek(firstCellOnLastRow)) { return true; } else { return seekToPreviousRow(higherCell); } }
protected int binarySearch(final Cell [] kvs, final byte [] family, final byte [] qualifier) { byte[] familyNotNull = notNullBytes(family); byte[] qualifierNotNull = notNullBytes(qualifier); Cell searchTerm = PrivateCellUtil.createFirstOnRow(kvs[0].getRowArray(), kvs[0].getRowOffset(), kvs[0].getRowLength(), familyNotNull, 0, (byte)familyNotNull.length, qualifierNotNull, 0, qualifierNotNull.length); // pos === ( -(insertion point) - 1) int pos = Arrays.binarySearch(kvs, searchTerm, CellComparator.getInstance()); // never will exact match if (pos < 0) { pos = (pos+1) * -1; // pos is now insertion point } if (pos == kvs.length) { return -1; // doesn't exist } return pos; }
byte[] column = columns.first(); Cell kvKey = PrivateCellUtil.createFirstOnRow(row, HConstants.EMPTY_BYTE_ARRAY, column); return passesGeneralRowColBloomFilter(kvKey);
/** * @param currentRowCell * @return true when the joined heap may have data for the current row * @throws IOException */ private boolean joinedHeapMayHaveData(Cell currentRowCell) throws IOException { Cell nextJoinedKv = joinedHeap.peek(); boolean matchCurrentRow = nextJoinedKv != null && CellUtil.matchingRows(nextJoinedKv, currentRowCell); boolean matchAfterSeek = false; // If the next value in the joined heap does not match the current row, try to seek to the // correct row if (!matchCurrentRow) { Cell firstOnCurrentRow = PrivateCellUtil.createFirstOnRow(currentRowCell); boolean seekSuccessful = this.joinedHeap.requestSeek(firstOnCurrentRow, true, true); matchAfterSeek = seekSuccessful && joinedHeap.peek() != null && CellUtil.matchingRows(joinedHeap.peek(), currentRowCell); } return matchCurrentRow || matchAfterSeek; }
Cell rowBloomKey = PrivateCellUtil.createFirstOnRow(kvKey);