Skip to content

Commit 6d8cbc9

Browse files
bchong95Jake Willey
authored andcommitted
Max Item Count Fix (#867)
* reproed scenario * fixed scenario * fixed test
1 parent 6041009 commit 6d8cbc9

File tree

2 files changed

+70
-118
lines changed

2 files changed

+70
-118
lines changed

Microsoft.Azure.Cosmos/src/Query/Core/ExecutionContext/PipelinedDocumentQueryExecutionContext.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,17 @@ public static async Task<CosmosQueryExecutionContext> CreateAsync(
146146

147147
QueryInfo queryInfo = initParams.PartitionedQueryExecutionInfo.QueryInfo;
148148

149-
int actualPageSize = initParams.InitialPageSize;
150149
int initialPageSize = initParams.InitialPageSize;
151150
CosmosCrossPartitionQueryExecutionContext.CrossPartitionInitParams parameters = initParams;
152151
if (queryInfo.HasGroupBy)
153152
{
154-
initialPageSize = int.MaxValue;
153+
// The query will block until all groupings are gathered so we might as well speed up the process.
155154
initParams = new CosmosCrossPartitionQueryExecutionContext.CrossPartitionInitParams(
156155
sqlQuerySpec: initParams.SqlQuerySpec,
157156
collectionRid: initParams.CollectionRid,
158157
partitionedQueryExecutionInfo: initParams.PartitionedQueryExecutionInfo,
159158
partitionKeyRanges: initParams.PartitionKeyRanges,
160-
initialPageSize: initialPageSize,
159+
initialPageSize: int.MaxValue,
161160
maxConcurrency: initParams.MaxConcurrency,
162161
maxItemCount: int.MaxValue,
163162
maxBufferedItemCount: initParams.MaxBufferedItemCount);

0 commit comments

Comments
 (0)