public final class Query implements Serializable
A simple wrapper to construct a query for the ReadRows RPC.
Static Methods
create(String tableId)
public static Query create(String tableId)
Parameter
Returns
fromProto(ReadRowsRequest request)
public static Query fromProto(ReadRowsRequest request)
Wraps the protobuf ReadRowsRequest.
WARNING: Please note that the project id & instance id in the table name will be overwritten
by the configuration in the BigtableDataClient.
Parameter
Returns
Methods
clone()
Returns
Overrides
equals(Object o)
public boolean equals(Object o)
Parameter
Returns
Overrides
filter(Filters.Filter filter)
public Query filter(Filters.Filter filter)
Parameter
Returns
getBound()
public Range.ByteStringRange getBound()
Get the minimal range that encloses all of the row keys and ranges in this Query.
Returns
hashCode()
Returns
Overrides
limit(long limit)
public Query limit(long limit)
Limits the number of rows that can be returned
Parameter
Returns
prefix(ByteString prefix)
public Query prefix(ByteString prefix)
Parameter
Returns
prefix(String prefix)
public Query prefix(String prefix)
Parameter
Returns
range(Range.ByteStringRange range)
public Query range(Range.ByteStringRange range)
Adds a range to be looked up.
Parameter
Returns
range(ByteString start, ByteString end)
public Query range(ByteString start, ByteString end)
Adds a range to be looked up.
Parameters
Name | Description |
start | ByteString
The beginning of the range (inclusive). Can be null to represent negative
infinity.
|
end | ByteString
The end of the range (exclusive). Can be null to represent positive infinity.
|
Returns
range(String start, String end)
public Query range(String start, String end)
Adds a range to be looked up.
Parameters
Name | Description |
start | String
The beginning of the range (inclusive). Can be null to represent negative
infinity.
|
end | String
The end of the range (exclusive). Can be null to represent positive infinity.
|
Returns
rowKey(ByteString key)
public Query rowKey(ByteString key)
Parameter
Returns
rowKey(String key)
public Query rowKey(String key)
Parameter
Returns
shard(List<KeyOffset> sampledRowKeys)
public List<Query> shard(List<KeyOffset> sampledRowKeys)
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<KeyOffset> keyOffsets = dataClient.sampleRowKeysAsync("my-table").get();
List<Query> queryShards = myQuery.shard(keyOffsets);
List
Parameter
Returns
shard(SortedSet<ByteString> splitPoints)
public List<Query> shard(SortedSet<ByteString> splitPoints)
Split this query into multiple queries that logically combine into this query. This is intended
to be used by map reduce style frameworks like Beam to split a query across multiple workers.
Expected Usage:
List<ByteString> splitPoints = ...;
List<Query> queryShards = myQuery.shard(splitPoints);
List
Parameter
Returns
toProto(RequestContext requestContext)
public ReadRowsRequest toProto(RequestContext requestContext)
Creates the request protobuf. This method is considered an internal implementation detail and
not meant to be used by applications.
Parameter
Name | Description |
requestContext | com.google.cloud.bigtable.data.v2.internal.RequestContext
|
Returns
toString()
Returns
Overrides