Azure-Samples / azure-cosmos-java-sql-api-samples

Sample code for Azure Cosmos DB Java SDK for SQL API
MIT License
40 stars 72 forks source link

Sample Code Incorrect For BufferedItemCount In Parallel Query #70

Open ssharma100 opened 3 months ago

ssharma100 commented 3 months ago

https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/3a7314e6062c8edf9335f727aee1058cdcf24519/src/main/java/com/azure/cosmos/examples/queries/sync/QueriesQuickstart.java#L211

In the sample code Line: 263: parallelQueryWithPagingAndContinuationTokenAndPrintQueryCharge()

The example method attempts to re-use the existing method:

    options.setMaxDegreeOfParallelism(0);
    options.setMaxBufferedItemCount(100);
    queryWithPagingAndContinuationTokenAndPrintQueryCharge(options);

Here, the expectation is that the "options" that have the parallel query specific options/settings will be passed to: parallelQueryWithPagingAndContinuationTokenAndPrintQueryCharge - in the method that is called the options parameter passed in the method is never used.

The parallelQueryWithPagingAndContinuationTokenAndPrintQueryCharge() method is written to set its own "default" CosmosQueryRequestOptions and never honor or checks for the parameter.

Likewise the main execution of the queriesDemo() Line 102 calls the method with a new constructor to satisfy the parameter signature, but it too is not used.