Skip to content

Commit 949dbed

Browse files
committed
fix: HPK QueryRequest Option fix
1 parent 80924ef commit 949dbed

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

Microsoft.Azure.Cosmos/src/Handler/RequestInvokerHandler.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,24 @@ public virtual async Task<ResponseMessage> SendAsync(
305305
// For epk range filtering we can end up in one of 3 cases:
306306
if (overlappingRanges.Count > 1)
307307
{
308-
// 1) The EpkRange spans more than one physical partition
309-
// In this case it means we have encountered a split and
310-
// we need to bubble that up to the higher layers to update their datastructures
311-
CosmosException goneException = new CosmosException(
312-
message: $"Epk Range: {feedRangeEpk.Range} is gone.",
313-
statusCode: System.Net.HttpStatusCode.Gone,
314-
subStatusCode: (int)SubStatusCodes.PartitionKeyRangeGone,
315-
activityId: Guid.NewGuid().ToString(),
316-
requestCharge: default);
317-
318-
return goneException.ToCosmosResponseMessage(request);
308+
bool isQueryOperation = request.ResourceType == ResourceType.Document && request.OperationType == OperationType.QueryPlan;
309+
if (!isQueryOperation)
310+
{
311+
// 1) The EpkRange spans more than one physical partition
312+
// In this case it means we have encountered a split and
313+
// we need to bubble that up to the higher layers to update their datastructures
314+
CosmosException goneException = new CosmosException(
315+
message: $"Epk Range: {feedRangeEpk.Range} is gone.",
316+
statusCode: System.Net.HttpStatusCode.Gone,
317+
subStatusCode: (int)SubStatusCodes.PartitionKeyRangeGone,
318+
activityId: Guid.NewGuid().ToString(),
319+
requestCharge: default);
320+
321+
return goneException.ToCosmosResponseMessage(request);
322+
}
323+
// For query operations spanning multiple partitions, we don't set PartitionKeyRangeId
324+
// because the query engine needs to handle this case differently
325+
// Just continue without setting PartitionKeyRangeId
319326
}
320327
// overlappingRanges.Count == 1
321328
else

0 commit comments

Comments
 (0)