本文整理了Java中com.google.cloud.bigtable.data.v2.models.Query.filter
方法的一些代码示例,展示了Query.filter
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.filter
方法的具体详情如下:
包路径:com.google.cloud.bigtable.data.v2.models.Query
类名称:Query
方法名:filter
[英]Sets the filter to apply to each row. Only one filter can be set at a time. To use multiple filters, please use Filters#interleave() or Filters#chain().
[中]
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void serializationTest() throws IOException, ClassNotFoundException {
Query expected = Query.create(TABLE_ID).filter(FILTERS.key().regex(".*"));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(expected);
oos.close();
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
Query actual = (Query) ois.readObject();
assertThat(actual.toProto(requestContext)).isEqualTo(expected.toProto(requestContext));
}
代码示例来源:origin: googleapis/google-cloud-java
Query query = Query.create(tableId).rowKey(rowKey);
if (filter != null) {
query = query.filter(filter);
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void filterTest() {
Query query = Query.create(TABLE_ID).filter(FILTERS.key().regex(".*"));
Builder expectedProto =
expectedProtoBuilder()
.setFilter(RowFilter.newBuilder().setRowKeyRegexFilter(ByteString.copyFromUtf8(".*")));
ReadRowsRequest actualProto = query.toProto(requestContext);
assertThat(actualProto).isEqualTo(expectedProto.build());
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void readRowStrFilterTest() {
// Build the filter expression
Filter filter =
FILTERS
.chain()
.filter(FILTERS.qualifier().regex("prefix.*"))
.filter(FILTERS.limit().cellsPerRow(10));
Row expectedRow =
Row.create(ByteString.copyFromUtf8("fake-row-key"), ImmutableList.<RowCell>of());
Mockito.when(
mockReadRowCallable.futureCall(
Query.create("fake-table").rowKey("fake-row-key").filter(filter)))
.thenReturn(ApiFutures.immediateFuture(expectedRow));
Row actualRow = bigtableDataClient.readRow("fake-table", "fake-row-key", filter);
assertThat(actualRow).isEqualTo(expectedRow);
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void readRowFilterTest() {
// Build the filter expression
Filter filter =
FILTERS
.chain()
.filter(FILTERS.qualifier().regex("prefix.*"))
.filter(FILTERS.limit().cellsPerRow(10));
Row expectedRow =
Row.create(ByteString.copyFromUtf8("fake-row-key"), ImmutableList.<RowCell>of());
Mockito.when(
mockReadRowCallable.futureCall(
Query.create("fake-table").rowKey("fake-row-key").filter(filter)))
.thenReturn(ApiFutures.immediateFuture(expectedRow));
Row actualRow =
bigtableDataClient.readRow("fake-table", ByteString.copyFromUtf8("fake-row-key"), filter);
assertThat(actualRow).isEqualTo(expectedRow);
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void readRowFilterAsyncTest() {
// Build the filter expression
Filter filter =
FILTERS
.chain()
.filter(FILTERS.qualifier().regex("prefix.*"))
.filter(FILTERS.limit().cellsPerRow(10));
bigtableDataClient.readRowAsync("fake-table", ByteString.copyFromUtf8("fake-row-key"), filter);
Mockito.verify(mockReadRowCallable)
.futureCall(Query.create("fake-table").rowKey("fake-row-key").filter(filter));
}
代码示例来源:origin: googleapis/google-cloud-java
@Test
public void readRowFilterStrAsyncTest() {
// Build the filter expression
Filter filter =
FILTERS
.chain()
.filter(FILTERS.qualifier().regex("prefix.*"))
.filter(FILTERS.limit().cellsPerRow(10));
bigtableDataClient.readRowAsync("fake-table", "fake-row-key", filter);
Mockito.verify(mockReadRowCallable)
.futureCall(Query.create("fake-table").rowKey("fake-row-key").filter(filter));
}
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
/** {@inheritDoc} */
@Override
public void adapt(Get operation, ReadHooks readHooks, Query query) {
Scan operationAsScan = new Scan(addKeyOnlyFilter(operation));
scanAdapter.throwIfUnsupportedScan(operationAsScan);
query.filter(scanAdapter.buildFilter(operationAsScan, readHooks))
.rowKey(ByteString.copyFrom(operation.getRow()));
}
代码示例来源:origin: com.google.cloud/google-cloud-bigtable
Query query = Query.create(tableId).rowKey(rowKey);
if (filter != null) {
query = query.filter(filter);
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
/** {@inheritDoc} */
@Override
public void adapt(Scan scan, ReadHooks readHooks, Query query) {
throwIfUnsupportedScan(scan);
toByteStringRange(scan, query);
query.filter(buildFilter(scan, readHooks));
if (LIMIT_AVAILABLE && scan.getLimit() > 0) {
query.limit(scan.getLimit());
}
}
内容来源于网络,如有侵权,请联系作者删除!