@Override public void internalExtractResult(long startTs, ColumnSelection selection, byte[] row, byte[] col, byte[] val, long ts) { if (ts < startTs && selection.contains(col)) { Cell cell = Cell.create(row, col); if (!collector.containsKey(cell)) { collector.put(cell, Value.create(val, ts)); } else { notLatestVisibleValueCellFilterMeter.mark(); } } else { notLatestVisibleValueCellFilterMeter.mark(); } }
orignalReads = Maps.filterKeys(orignalReads, input -> columns.contains(input.getColumnName()));
@Override @SuppressWarnings({"CheckReturnValue"}) // Consume all remaining values of iterator. public Map<Cell, Value> getRows(TableReference tableRef, Iterable<byte[]> rows, ColumnSelection columnSelection, long timestamp) { Map<Cell, Value> result = Maps.newHashMap(); ConcurrentSkipListMap<Key, byte[]> table = getTableMap(tableRef).entries; for (byte[] row : rows) { Cell rowBegin = Cells.createSmallestCellForRow(row); Cell rowEnd = Cells.createLargestCellForRow(row); PeekingIterator<Entry<Key, byte[]>> entries = Iterators.peekingIterator(table.subMap( new Key(rowBegin, Long.MIN_VALUE), new Key(rowEnd, timestamp)).entrySet().iterator()); while (entries.hasNext()) { Entry<Key, byte[]> entry = entries.peek(); Key key = entry.getKey(); Iterator<Entry<Key, byte[]>> cellIter = takeCell(entries, key); if (columnSelection.contains(key.col)) { getLatestVersionOfCell(row, key, cellIter, timestamp, result); } Iterators.size(cellIter); } } return result; }
@Override public void internalExtractResult(long startTs, ColumnSelection selection, byte[] row, byte[] col, byte[] val, long ts) { if (ts < startTs && selection.contains(col)) { Cell cell = Cell.create(row, col); if (!collector.containsKey(cell)) { collector.put(cell, Value.create(val, ts)); } else { notLatestVisibleValueCellFilterMeter.mark(); } } else { notLatestVisibleValueCellFilterMeter.mark(); } }
orignalReads = Maps.filterKeys(orignalReads, input -> columns.contains(input.getColumnName()));
static void getRow(RocksIterator iter, byte[] row, ColumnSelection columnSelection, long timestamp, @Output Map<Cell, Value> results) { iter.seek(getKey(row, timestamp - 1)); byte[] col = null; for (; iter.isValid(); iter.next()) { Pair<Cell, Long> cellAndTs = parseCellAndTs(iter.key()); if (!Arrays.equals(row, cellAndTs.lhSide.getRowName())) { return; } if (cellAndTs.rhSide >= timestamp || !columnSelection.contains(cellAndTs.lhSide.getColumnName()) || Arrays.equals(col, cellAndTs.lhSide.getColumnName())) { continue; } col = cellAndTs.lhSide.getColumnName(); results.put(cellAndTs.lhSide, Value.create(iter.value(), cellAndTs.rhSide)); } }
@Override @SuppressWarnings({"CheckReturnValue"}) // Consume all remaining values of iterator. public Map<Cell, Value> getRows(TableReference tableRef, Iterable<byte[]> rows, ColumnSelection columnSelection, long timestamp) { Map<Cell, Value> result = Maps.newHashMap(); ConcurrentSkipListMap<Key, byte[]> table = getTableMap(tableRef).entries; for (byte[] row : rows) { Cell rowBegin = Cells.createSmallestCellForRow(row); Cell rowEnd = Cells.createLargestCellForRow(row); PeekingIterator<Entry<Key, byte[]>> entries = Iterators.peekingIterator(table.subMap( new Key(rowBegin, Long.MIN_VALUE), new Key(rowEnd, timestamp)).entrySet().iterator()); while (entries.hasNext()) { Entry<Key, byte[]> entry = entries.peek(); Key key = entry.getKey(); Iterator<Entry<Key, byte[]>> cellIter = takeCell(entries, key); if (columnSelection.contains(key.col)) { getLatestVersionOfCell(row, key, cellIter, timestamp, result); } Iterators.size(cellIter); } } return result; }