com.google.bigtable.v1.RowRange

Here are the examples of the java api class com.google.bigtable.v1.RowRange taken from open source projects.

1. BigtableWriteIT#getTableData()

Project: incubator-beam
File: BigtableWriteIT.java
/** Helper function to get a table's data. */
private List<KV<ByteString, ByteString>> getTableData(String tableName) throws IOException {
    // Add empty range to avoid TARGET_NOT_SET error
    RowRange range = RowRange.newBuilder().setStartKey(ByteString.EMPTY).setEndKey(ByteString.EMPTY).build();
    List<KV<ByteString, ByteString>> tableData = new ArrayList<>();
    ReadRowsRequest.Builder readRowsRequestBuilder = ReadRowsRequest.newBuilder().setTableName(tableName).setRowRange(range);
    ResultScanner<Row> scanner = session.getDataClient().readRows(readRowsRequestBuilder.build());
    Row currentRow;
    while ((currentRow = scanner.next()) != null) {
        ByteString key = currentRow.getKey();
        ByteString value = currentRow.getFamilies(0).getColumns(0).getCells(0).getValue();
        tableData.add(KV.of(key, value));
    }
    scanner.close();
    return tableData;
}