Package com.google.datastore.v1.client
Interface QuerySplitter
-
public interface QuerySplitter
Provides the ability to split a query into multiple shards.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<Query>
getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore)
Returns a list of shardedQuery
s for the given query.default List<Query>
getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore, com.google.protobuf.Timestamp readTime)
Same asgetSplits(Query, PartitionId, int, Datastore)
but the splits are based onreadTime
, and the returned shardedQuery
s should also be executed withreadTime
.
-
-
-
Method Detail
-
getSplits
List<Query> getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore) throws DatastoreException
Returns a list of shardedQuery
s for the given query.This will create up to the desired number of splits, however it may return less splits if the desired number of splits is unavailable. This will happen if the number of split points provided by the underlying Datastore is less than the desired number, which will occur if the number of results for the query is too small.
- Parameters:
query
- the query to split.partition
- the partition the query is running in.numSplits
- the desired number of splits.datastore
- the datastore to run on.- Throws:
DatastoreException
- if there was a datastore error while generating query splits.IllegalArgumentException
- if the given query or numSplits was invalid.
-
getSplits
@BetaApi default List<Query> getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore, com.google.protobuf.Timestamp readTime) throws DatastoreException
Same asgetSplits(Query, PartitionId, int, Datastore)
but the splits are based onreadTime
, and the returned shardedQuery
s should also be executed withreadTime
. Reading from a timestamp is currently a private preview feature in Datastore.- Throws:
DatastoreException
-
-