use of com.google.cloud.bigtable.data.v2.models.Row in project java-docs-samples by GoogleCloudPlatform.
the class CassandraMigrationCodelab method get.
public void get() {
try {
String rowKey = "phone#4c410523#20190501";
Row row = dataClient.readRow(tableId, rowKey);
for (RowCell cell : row.getCells()) {
System.out.printf("Family: %s Qualifier: %s Value: %s Timestamp: %s%n", cell.getFamily(), cell.getQualifier().toStringUtf8(), cell.getValue().toStringUtf8(), cell.getTimestamp());
}
} catch (Exception e) {
System.out.println("Error during lookup: \n" + e.toString());
}
}
use of com.google.cloud.bigtable.data.v2.models.Row in project java-docs-samples by GoogleCloudPlatform.
the class CassandraMigrationCodelab method scan.
public void scan() {
try {
Query query = Query.create(tableId).range("tablet#a0b81f74#201905", "tablet#a0b81f74#201906");
ServerStream<Row> rowStream = dataClient.readRows(query);
for (Row row : rowStream) {
System.out.println("Row Key: " + row.getKey().toStringUtf8());
for (RowCell cell : row.getCells()) {
System.out.printf("Family: %s Qualifier: %s Value: %s Timestamp: %s%n", cell.getFamily(), cell.getQualifier().toStringUtf8(), cell.getValue().toStringUtf8(), cell.getTimestamp());
}
}
} catch (Exception e) {
System.out.println("Error during scan: \n" + e.toString());
}
}
use of com.google.cloud.bigtable.data.v2.models.Row in project testcontainers-java by testcontainers.
the class BigtableEmulatorContainerTest method testSimple.
// }
@Test
public // testWithEmulatorContainer {
void testSimple() throws IOException, InterruptedException, ExecutionException {
ManagedChannel channel = ManagedChannelBuilder.forTarget(emulator.getEmulatorEndpoint()).usePlaintext().build();
TransportChannelProvider channelProvider = FixedTransportChannelProvider.create(GrpcTransportChannel.create(channel));
NoCredentialsProvider credentialsProvider = NoCredentialsProvider.create();
try {
createTable(channelProvider, credentialsProvider, "test-table");
BigtableDataClient client = BigtableDataClient.create(BigtableDataSettings.newBuilderForEmulator(emulator.getHost(), emulator.getEmulatorPort()).setProjectId(PROJECT_ID).setInstanceId(INSTANCE_ID).build());
client.mutateRow(RowMutation.create("test-table", "1").setCell("name", "firstName", "Ray"));
Row row = client.readRow("test-table", "1");
List<RowCell> cells = row.getCells("name", "firstName");
assertThat(cells).isNotNull().hasSize(1);
assertThat(cells.get(0).getValue().toStringUtf8()).isEqualTo("Ray");
} finally {
channel.shutdown();
}
}
use of com.google.cloud.bigtable.data.v2.models.Row in project java-bigtable-hbase by googleapis.
the class AbstractBigtableTable method checkAndDelete.
/**
* {@inheritDoc}
*/
@Override
public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareFilter.CompareOp compareOp, byte[] value, Delete delete) throws IOException {
LOG.trace("checkAndDelete(byte[], byte[], byte[], CompareOp, byte[], Delete)");
ConditionalRowMutation request = new CheckAndMutateUtil.RequestBuilder(hbaseAdapter, row, family).qualifier(qualifier).ifMatches(compareOp, value).withDelete(delete).build();
return checkAndMutate(row, request, "checkAndDelete");
}
use of com.google.cloud.bigtable.data.v2.models.Row in project java-bigtable-hbase by googleapis.
the class ColumnPaginationFilterAdapter method createChain.
/**
* Create a filter chain that allows the latest values for each qualifier, those cells that pass
* an option intermediate filter and are less than the limit per row.
*/
private Filter createChain(ColumnPaginationFilter filter, Filter intermediate) {
ChainFilter chain = FILTERS.chain();
chain.filter(FILTERS.limit().cellsPerColumn(1));
if (intermediate != null) {
chain.filter(intermediate);
}
chain.filter(FILTERS.limit().cellsPerRow(filter.getLimit()));
return chain;
}
Aggregations