本文整理了Java中com.google.cloud.bigtable.data.v2.models.Query.shard
方法的一些代码示例,展示了Query.shard
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.shard
方法的具体详情如下:
包路径:com.google.cloud.bigtable.data.v2.models.Query
类名称:Query
方法名:shard
[英]Split this query into multiple queries that can be evenly distributed across Bigtable nodes and be run in parallel. This method takes the results from com.google.cloud.bigtable.data.v2.BigtableDataClient#sampleRowKeysAsync(String) to divide this query into a set of disjoint queries that logically combine into form this query.
Expected Usage:
List keyOffsets = dataClient.sampleRowKeysAsync("my-table").get();List> results = ApiFutures.allAsList(futures).get();
}
[中]将此查询拆分为多个查询,这些查询可以均匀分布在Bigtable节点上并并行运行。此方法从com获取结果。谷歌。云大桌子。数据v2。BigtableDataClient#SampleRowKeyAsync(字符串)将此查询划分为一组不相交的查询,这些查询在逻辑上组合成此查询。
预期用途:
List keyOffsets = dataClient.sampleRowKeysAsync("my-table").get();List> results = ApiFutures.allAsList(futures).get();
}
代码示例来源:origin: googleapis/google-cloud-java
/**
* Split this query into multiple queries that can be evenly distributed across Bigtable nodes and
* be run in parallel. This method takes the results from {@link
* com.google.cloud.bigtable.data.v2.BigtableDataClient#sampleRowKeysAsync(String)} to divide this
* query into a set of disjoint queries that logically combine into form this query.
*
* <p>Expected Usage:
*
* <pre>{@code
* List<KeyOffset> keyOffsets = dataClient.sampleRowKeysAsync("my-table").get();
* List<Query> queryShards = myQuery.shard(keyOffsets);
* List<ApiFuture<List<Row>>> futures = new ArrayList();
* for (Query subQuery : queryShards) {
* futures.add(dataClient.readRowsCallable().all().futureCall(subQuery));
* }
* List<List<Row>> results = ApiFutures.allAsList(futures).get();
* }</pre>
*/
public List<Query> shard(List<KeyOffset> sampledRowKeys) {
Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard query with row limits");
ImmutableSortedSet.Builder<ByteString> splitPoints =
ImmutableSortedSet.orderedBy(ByteStringComparator.INSTANCE);
for (KeyOffset keyOffset : sampledRowKeys) {
if (!keyOffset.getKey().isEmpty()) {
splitPoints.add(keyOffset.getKey());
}
}
return shard(splitPoints.build());
}
代码示例来源:origin: googleapis/google-cloud-java
KeyOffset.create(ByteString.EMPTY, 100));
List<Query> subQueries = query.shard(keyOffsets);
代码示例来源:origin: googleapis/google-cloud-java
.build();
List<Query> subQueries = query.shard(splitPoints);
代码示例来源:origin: com.google.cloud/google-cloud-bigtable
/**
* Split this query into multiple queries that can be evenly distributed across Bigtable nodes and
* be run in parallel. This method takes the results from {@link
* com.google.cloud.bigtable.data.v2.BigtableDataClient#sampleRowKeysAsync(String)} to divide this
* query into a set of disjoint queries that logically combine into form this query.
*
* <p>Expected Usage:
*
* <pre>{@code
* List<KeyOffset> keyOffsets = dataClient.sampleRowKeysAsync("my-table").get();
* List<Query> queryShards = myQuery.shard(keyOffsets);
* List<ApiFuture<List<Row>>> futures = new ArrayList();
* for (Query subQuery : queryShards) {
* futures.add(dataClient.readRowsCallable().all().futureCall(subQuery));
* }
* List<List<Row>> results = ApiFutures.allAsList(futures).get();
* }</pre>
*/
public List<Query> shard(List<KeyOffset> sampledRowKeys) {
Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard query with row limits");
ImmutableSortedSet.Builder<ByteString> splitPoints =
ImmutableSortedSet.orderedBy(ByteStringComparator.INSTANCE);
for (KeyOffset keyOffset : sampledRowKeys) {
if (!keyOffset.getKey().isEmpty()) {
splitPoints.add(keyOffset.getKey());
}
}
return shard(splitPoints.build());
}
内容来源于网络,如有侵权,请联系作者删除!