use of com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection in project atlasdb by palantir.
the class AbstractKeyValueServiceTest method testGetRowColumnRangeCellBatchHistorical.
@Test
public void testGetRowColumnRangeCellBatchHistorical() {
putTestDataForMultipleTimestamps();
RowColumnRangeIterator values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row0), new ColumnRangeSelection(PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY), 1, TEST_TIMESTAMP + 2);
assertNextElementMatches(values, TEST_CELL, value0_t1);
assertFalse(values.hasNext());
values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row0), new ColumnRangeSelection(PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY), 1, TEST_TIMESTAMP + 1);
assertNextElementMatches(values, TEST_CELL, value0_t0);
assertFalse(values.hasNext());
}
use of com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection in project atlasdb by palantir.
the class AbstractKeyValueServiceTest method testGetRowColumnRangeCellBatchSingleRow.
@Test
public void testGetRowColumnRangeCellBatchSingleRow() {
putTestDataForSingleTimestamp();
RowColumnRangeIterator values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row1), new ColumnRangeSelection(PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY), 1, TEST_TIMESTAMP + 1);
assertNextElementMatches(values, Cell.create(row1, column0), value10);
assertNextElementMatches(values, Cell.create(row1, column2), value12);
assertFalse(values.hasNext());
values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row1), new ColumnRangeSelection(RangeRequests.nextLexicographicName(column0), PtBytes.EMPTY_BYTE_ARRAY), 1, TEST_TIMESTAMP + 1);
assertNextElementMatches(values, Cell.create(row1, column2), value12);
assertFalse(values.hasNext());
values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row1), new ColumnRangeSelection(RangeRequests.nextLexicographicName(column0), column2), 1, TEST_TIMESTAMP + 1);
assertFalse(values.hasNext());
values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row1), new ColumnRangeSelection(RangeRequests.nextLexicographicName(column2), PtBytes.EMPTY_BYTE_ARRAY), 1, TEST_TIMESTAMP + 1);
assertFalse(values.hasNext());
values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row1), new ColumnRangeSelection(PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY), Integer.MAX_VALUE, TEST_TIMESTAMP + 1);
assertNextElementMatches(values, Cell.create(row1, column0), value10);
assertNextElementMatches(values, Cell.create(row1, column2), value12);
assertFalse(values.hasNext());
}
use of com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection in project atlasdb by palantir.
the class AbstractKeyValueServiceTest method testGetRowColumnRangeCellBatchMultipleHistorical.
@Test
public void testGetRowColumnRangeCellBatchMultipleHistorical() {
keyValueService.put(TEST_TABLE, ImmutableMap.of(Cell.create(row1, column0), value0_t0), TEST_TIMESTAMP);
keyValueService.put(TEST_TABLE, ImmutableMap.of(Cell.create(row1, column0), value0_t1), TEST_TIMESTAMP + 1);
keyValueService.put(TEST_TABLE, ImmutableMap.of(Cell.create(row1, column1), value0_t0), TEST_TIMESTAMP);
keyValueService.put(TEST_TABLE, ImmutableMap.of(Cell.create(row1, column1), value0_t1), TEST_TIMESTAMP + 1);
RowColumnRangeIterator values = keyValueService.getRowsColumnRange(TEST_TABLE, ImmutableList.of(row1), new ColumnRangeSelection(PtBytes.EMPTY_BYTE_ARRAY, RangeRequests.nextLexicographicName(column1)), 2, TEST_TIMESTAMP + 1);
assertNextElementMatches(values, Cell.create(row1, column0), value0_t0);
assertNextElementMatches(values, Cell.create(row1, column1), value0_t0);
assertFalse(values.hasNext());
}
use of com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection in project atlasdb by palantir.
the class TransactionGetRowsColumnRangeBenchmarks method getAllColumnsSingleBigRow.
@Benchmark
@Threads(1)
@Warmup(time = 16, timeUnit = TimeUnit.SECONDS)
@Measurement(time = 160, timeUnit = TimeUnit.SECONDS)
public Object getAllColumnsSingleBigRow(VeryWideRowTable table, Blackhole blackhole) {
return table.getTransactionManager().runTaskThrowOnConflict(txn -> {
Iterator<Map.Entry<Cell, byte[]>> iter = txn.getRowsColumnRange(table.getTableRef(), Collections.singleton(Tables.ROW_BYTES.array()), new ColumnRangeSelection(null, null), 10000);
int count = 0;
while (iter.hasNext()) {
blackhole.consume(iter.next());
++count;
}
Preconditions.checkState(count == table.getNumCols(), "Should be %s columns, but were: %s", table.getNumCols(), count);
return count;
});
}
use of com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection in project atlasdb by palantir.
the class KvsGetRowsColumnRangeBenchmarks method getAllColumnsUnaligned.
@Benchmark
@Threads(1)
@Warmup(time = 16, timeUnit = TimeUnit.SECONDS)
@Measurement(time = 160, timeUnit = TimeUnit.SECONDS)
public Object getAllColumnsUnaligned(WideRowsTable table) {
List<byte[]> rows = IntStream.rangeClosed(0, WideRowsTable.NUM_ROWS - 1).mapToObj(WideRowsTable::getRow).collect(Collectors.toList());
RowColumnRangeIterator rowsColumnRange = table.getKvs().getRowsColumnRange(table.getTableRef(), rows, new ColumnRangeSelection(null, null), 10017, Long.MAX_VALUE);
int expectedNumCells = WideRowsTable.NUM_ROWS * WideRowsTable.NUM_COLS_PER_ROW;
List<Map.Entry<Cell, Value>> loadedCells = new ArrayList<>(expectedNumCells);
while (rowsColumnRange.hasNext()) {
loadedCells.add(rowsColumnRange.next());
}
Preconditions.checkState(loadedCells.size() == expectedNumCells, "Should be %s cells, but were: %s", expectedNumCells, loadedCells.size());
return loadedCells;
}
Aggregations