Azure / azure-cosmosdb-java

Java Async SDK for SQL API of Azure Cosmos DB
MIT License
54 stars 61 forks source link

How to partition the query to different physical partitions. #57

Closed zhouchong90 closed 6 years ago

zhouchong90 commented 6 years ago

Hi,

I'm trying to execute a very large query that needs to return millions of records, so I want to partition the query and use multiple machines to process the results.

My logical partition key would be a UUID of a document, so that will not be very helpful for me to allocate different parts to each worker node. Can I get the physical partition ID and execute my query only within a particular physical partition?

Here's what I have tried:

FeedOptions feedOptions = new FeedOptions(); feedOptions.setEnableCrossPartitionQuery(false); feedOptions.setPartitionKeyRangeIdInternal("0");

client.queryDocuments(collectionPath, "SELECT * FROM e where e.docType = 'address'", feedOptions) .flatMapIterable(FeedResponse::getResults);

But changing the partitionKeyRangeId doesn't seem to change the results at all.

Please advise.

moderakh commented 6 years ago

@zhouchong90 which version of the SDK are you using?

zhouchong90 commented 6 years ago

I'm currently using 1.0.0. Is there a new feature in the latest version that changes this?

moderakh commented 6 years ago

@zhouchong90 you are on a very old version. We are doing active development and bugfixes and this issue has been fixed a while back. As of now the latest version is 2.0.1.