com.google.cloud.bigtable.data.v2.models.Query.limit()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(222)

本文整理了Java中com.google.cloud.bigtable.data.v2.models.Query.limit方法的一些代码示例,展示了Query.limit的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.limit方法的具体详情如下:
包路径:com.google.cloud.bigtable.data.v2.models.Query
类名称:Query
方法名:limit

Query.limit介绍

[英]Limits the number of rows that can be returned
[中]限制可以返回的行数

代码示例

代码示例来源:origin: googleapis/google-cloud-java

@Override
 public ApiFuture<RowT> futureCall(Query query, ApiCallContext context) {
  return inner.futureCall(query.limit(1), context);
 }
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void testLimitAdded() {
 ReadRowsFirstCallable<Row> callable = new ReadRowsFirstCallable<>(innerCallable);
 innerResult.set(null);
 callable.call(Query.create("fake-table"));
 Truth.assertThat(innerQuery.getValue().toProto(REQUEST_CONTEXT))
   .isEqualTo(Query.create("fake-table").limit(1).toProto(REQUEST_CONTEXT));
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void limitTest() {
 Query query = Query.create(TABLE_ID).limit(10);
 Builder expectedProto = expectedProtoBuilder().setRowsLimit(10);
 ReadRowsRequest actualProto = query.toProto(requestContext);
 assertThat(actualProto).isEqualTo(expectedProto.build());
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void errorAfterRowLimitMetTest() {
 service.expectations.add(
   RpcExpectation.create()
     .expectRequest(Range.closedOpen("r1", "r3"))
     .expectRowLimit(2)
     .respondWith("r1", "r2")
     .respondWithStatus(Code.UNAVAILABLE));
 // Second retry request is handled locally in ReadRowsRetryCompletedCallable
 List<String> actualResults = getResults(Query.create(TABLE_ID).range("r1", "r3").limit(2));
 Truth.assertThat(actualResults).containsExactly("r1", "r2");
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
 public void testFirstIsLimited() {
  ServerStreamingStashCallable<ReadRowsRequest, Row> innerCallable =
    new ServerStreamingStashCallable<>();
  ReadRowsUserCallable<Row> callable = new ReadRowsUserCallable<>(innerCallable, REQUEST_CONTEXT);
  Query query = Query.create("fake-table");

  callable.first().call(query);

  Truth.assertThat(innerCallable.getActualRequest())
    .isEqualTo(query.limit(1).toProto(REQUEST_CONTEXT));
 }
}

代码示例来源:origin: googleapis/google-cloud-java

@Test
public void rowLimitTest() {
 service.expectations.add(
   RpcExpectation.create()
     .expectRequest(Range.closedOpen("r1", "r3"))
     .expectRowLimit(2)
     .respondWith("r1")
     .respondWithStatus(Code.UNAVAILABLE));
 service.expectations.add(
   RpcExpectation.create()
     .expectRequest(Range.open("r1", "r3"))
     .expectRowLimit(1)
     .respondWith("r2"));
 List<String> actualResults = getResults(Query.create(TABLE_ID).range("r1", "r3").limit(2));
 Truth.assertThat(actualResults).containsExactly("r1", "r2").inOrder();
}

代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client

@Override
 public Query apply(Query query) {
  return query.limit(pageSize);
 }
});

代码示例来源:origin: com.google.cloud/google-cloud-bigtable

@Override
 public ApiFuture<RowT> futureCall(Query query, ApiCallContext context) {
  return inner.futureCall(query.limit(1), context);
 }
}

代码示例来源: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());
 }
}

相关文章