@SuppressWarnings({"CheckReturnValue"}) // Consume all remaining values of iterator. private static <T> void collectValueForTimestamp(byte[] col, Iterator<Entry<Key, byte[]>> timestampValues, @Output ImmutableSortedMap.Builder<byte[], T> results, RangeRequest range, ResultProducer<T> resultProducer) { T result = null; if (range.containsColumn(col)) { result = resultProducer.apply(timestampValues); } // exhaust remaining entries Iterators.size(timestampValues); if (result != null) { results.put(col, result); } }
@SuppressWarnings({"CheckReturnValue"}) // Consume all remaining values of iterator. private static <T> void collectValueForTimestamp(byte[] col, Iterator<Entry<Key, byte[]>> timestampValues, @Output ImmutableSortedMap.Builder<byte[], T> results, RangeRequest range, ResultProducer<T> resultProducer) { T result = null; if (range.containsColumn(col)) { result = resultProducer.apply(timestampValues); } // exhaust remaining entries Iterators.size(timestampValues); if (result != null) { results.put(col, result); } }
@Override protected RowResult<T> computeNext() { while (it.isValid()) { Pair<Cell, Long> cellAndTs = RocksDbKeyValueServices.parseCellAndTs(it.key()); Cell cell = cellAndTs.lhSide; if (!RocksDbKeyValueServices.isInRange(cell.getRowName(), request.getEndExclusive())) { break; } byte[] row = cell.getRowName(); ImmutableSortedMap.Builder<byte[], T> builder = ImmutableSortedMap.orderedBy(UnsignedBytes.lexicographicalComparator()); do { T value = processCell(cellAndTs); if (value != null && request.containsColumn(cell.getColumnName())) { builder.put(cell.getColumnName(), value); } if (!it.isValid()) { break; } cellAndTs = RocksDbKeyValueServices.parseCellAndTs(it.key()); cell = cellAndTs.lhSide; } while (Arrays.equals(row, cell.getRowName())); SortedMap<byte[], T> columns = builder.build(); if (!columns.isEmpty()) { return RowResult.create(row, columns); } } return endOfData(); }