Send feedback
Class Query (2.39.5)
Stay organized with collections
Save and categorize content based on your preferences.
Version 2.39.5 keyboard_arrow_down
public final class Query implements Serializable
A simple wrapper to construct a query for the ReadRows RPC.
Static Methods
create(TargetId targetId)
public static Query create ( TargetId targetId )
Parameter
Name
Description
targetId
TargetId
Returns
Type
Description
Query
create(String tableId) (deprecated)
public static Query create ( String tableId )
Parameter
Name
Description
tableId
String
Returns
Type
Description
Query
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
Name
Description
request
com.google.bigtable.v2.ReadRowsRequest
Returns
Type
Description
Query
Methods
clone()
Returns
Type
Description
Query
Overrides
createPaginator(int pageSize)
public Query . QueryPaginator createPaginator ( int pageSize )
Beta
This surface is stable yet it might be removed in the future.
This feature is covered by the Pre-GA Offerings Terms of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.
Create a query paginator that'll split the query into smaller chunks.
Example usage:
Query query = Query . create (...). range ( "a ", "z ");
Query . QueryPaginator paginator = query . createQueryPaginator ( 100 );
ByteString lastSeenRowKey = ByteString . EMPTY ;
do {
List<Row> rows = client . readRowsCallable (). all (). call ( paginator . getNextQuery ());
for ( Row row : rows ) {
// do some processing
lastSeenRow = row ;
}
} while ( paginator . advance ( lastSeenRowKey ));
Parameter
Name
Description
pageSize
int
equals(Object o)
public boolean equals ( Object o )
Parameter
Name
Description
o
Object
Overrides
filter(Filters.Filter filter)
public Query filter ( Filters . Filter filter )
Returns
Type
Description
Query
getBound()
public Range . ByteStringRange getBound ()
Get the minimal range that encloses all of the row keys and ranges in this Query.
hashCode()
Returns
Type
Description
int
Overrides
limit(long limit)
public Query limit ( long limit )
Limits the number of rows that can be returned
Parameter
Name
Description
limit
long
Returns
Type
Description
Query
prefix(ByteString prefix)
public Query prefix ( ByteString prefix )
Returns
Type
Description
Query
prefix(String prefix)
public Query prefix ( String prefix )
Parameter
Name
Description
prefix
String
Returns
Type
Description
Query
range(Range.ByteStringRange range)
public Query range ( Range . ByteStringRange range )
Adds a range to be looked up.
Returns
Type
Description
Query
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
Type
Description
Query
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
Type
Description
Query
reversed(boolean enable)
public Query reversed ( boolean enable )
Return rows in reverse order.
The row will be streamed in reverse lexiographic order of the keys. The row key ranges are
still expected to be oriented the same way as forwards. ie [a,c] where a <= c. The row content
will remain unchanged from the ordering forward scans. This is particularly useful to get the
last N records before a key:
query
. range ( ByteStringRange . unbounded (). endOpen ( "key "))
. limit ( 10 )
. reversed ( true )
Parameter
Name
Description
enable
boolean
Returns
Type
Description
Query
rowKey(ByteString key)
public Query rowKey ( ByteString key )
Returns
Type
Description
Query
rowKey(String key)
public Query rowKey ( String key )
Parameter
Name
Description
key
String
Returns
Type
Description
Query
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
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
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
Type
Description
com.google.bigtable.v2.ReadRowsRequest
toString()
Returns
Type
Description
String
Overrides
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-09-18 UTC."}