Interface QuerySplitter (2.20.1)

public interface QuerySplitter

Provides the ability to split a query into multiple shards.

Methods

getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore)

public abstract List<Query> getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore)

Returns a list of sharded Querys 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
Name Description
query Query

the query to split.

partition PartitionId

the partition the query is running in.

numSplits int

the desired number of splits.

datastore Datastore

the datastore to run on.

Returns
Type Description
List<Query>
Exceptions
Type Description
DatastoreException

if there was a datastore error while generating query splits.

getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore, Timestamp readTime)

public default List<Query> getSplits(Query query, PartitionId partition, int numSplits, Datastore datastore, Timestamp readTime)

Same as #getSplits(Query, PartitionId, int, Datastore) but the splits are based on readTime, and the returned sharded Querys should also be executed with readTime. Reading from a timestamp is currently a private preview feature in Datastore.

Parameters
Name Description
query Query
partition PartitionId
numSplits int
datastore Datastore
readTime Timestamp
Returns
Type Description
List<Query>
Exceptions
Type Description
DatastoreException