@Override public TokenBackedBasicResultsPage<RowResult<Set<Value>>, byte[]> withHandle(Handle handle) throws Exception { Collection<byte[]> rows = getRowsInRange(tableName, rangeRequest, timestamp, maxRows, handle); if (rows.isEmpty()) { return SimpleTokenBackedResultsPage.create(rangeRequest.getStartInclusive(), Collections.<RowResult<Set<Value>>> emptyList(), false); } ListMultimap<Cell, Value> timestamps = getAllVersionsInternal(tableName, rows, RangeRequests.extractColumnSelection(rangeRequest), timestamp); final Ordering<RowResult<Set<Value>>> ordering = RowResult.getOrderingByRowName(rangeRequest.isReverse()); final SortedSet<RowResult<Set<Value>>> result = ImmutableSortedSet.orderedBy(ordering) .addAll(AtlasSqlUtils.cellsToRows(timestamps)).build(); return SimpleTokenBackedResultsPage.create( AtlasSqlUtils.generateToken(rangeRequest, result.last().getRowName()), assertThatRowResultsAreOrdered(result, rangeRequest), rows.size() == maxRows); } });
@Override public TokenBackedBasicResultsPage<RowResult<Set<Long>>, byte[]> withHandle(Handle handle) throws Exception { Collection<byte[]> rows = getRowsInRange(tableName, rangeRequest, timestamp, maxRows, handle); if (rows.isEmpty()) { return SimpleTokenBackedResultsPage.create(rangeRequest.getStartInclusive(), Collections.<RowResult<Set<Long>>> emptyList(), false); } ColumnSelection columns = RangeRequests.extractColumnSelection(rangeRequest); ListMultimap<Cell,Long> timestamps = getAllTimestampsInternal(tableName, rows, columns, timestamp); final Ordering<RowResult<Set<Long>>> ordering = RowResult.<Set<Long>>getOrderingByRowName(rangeRequest.isReverse()); final SortedSet<RowResult<Set<Long>>> result = ImmutableSortedSet.orderedBy(ordering) .addAll(AtlasSqlUtils.cellsToRows(timestamps)).build(); return new SimpleTokenBackedResultsPage<RowResult<Set<Long>>, byte[]>( AtlasSqlUtils.generateToken(rangeRequest, result.last().getRowName()), assertThatRowResultsAreOrdered(result, rangeRequest), rows.size() == maxRows); } });
@Override public TokenBackedBasicResultsPage<RowResult<Value>, byte[]> withHandle(Handle handle) throws Exception { Collection<byte[]> rows = getRowsInRange(tableName, rangeRequest, timestamp, maxRows, handle); if (rows.isEmpty()) { return SimpleTokenBackedResultsPage.create( rangeRequest.getStartInclusive(), Collections.<RowResult<Value>> emptyList(), false); } ColumnSelection columns = RangeRequests.extractColumnSelection(rangeRequest); Map<Cell, Value> cells = getRows(tableName, rows, columns, timestamp); final Ordering<RowResult<Value>> ordering = RowResult.<Value>getOrderingByRowName(rangeRequest.isReverse()); final SortedSet<RowResult<Value>> result = ImmutableSortedSet.orderedBy(ordering) .addAll(AtlasSqlUtils.cellsToRows(cells)).build(); return SimpleTokenBackedResultsPage.create( AtlasSqlUtils.generateToken(rangeRequest, result.last().getRowName()), assertThatRowResultsAreOrdered(result, rangeRequest), rows.size() == maxRows); } });