Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Microsoft.Azure.Cosmos/src/Query/ParallelQuery/ItemProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,18 @@ private void PopulatePartitionKeyRangeInfo(CosmosRequestMessage request)

if (this.queryContext.ResourceTypeEnum.IsPartitioned())
{
request.ToDocumentServiceRequest().RouteTo(new PartitionKeyRangeIdentity(
this.queryContext.ContainerResourceId,
this.PartitionKeyRange.Id));
// If the request already has the logical partition key,
// then we shouldn't add the physical partition key range id.

bool hasPartitionKey = request.Headers.Get(HttpConstants.HttpHeaders.PartitionKey) != null;
if (!hasPartitionKey)
{
request
.ToDocumentServiceRequest()
.RouteTo(new PartitionKeyRangeIdentity(
this.queryContext.ContainerResourceId,
this.PartitionKeyRange.Id));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ internal static CosmosQueryResponse CreateResponse(
FeedResponse<CosmosElement> feedResponse,
CosmosSerializationOptions cosmosSerializationOptions)
{
return FeedResponseBinder.ConvertToCosmosQueryResponse(feedResponse, null);
return FeedResponseBinder.ConvertToCosmosQueryResponse(feedResponse, cosmosSerializationOptions);
}

/// <summary>
Expand Down Expand Up @@ -262,8 +262,10 @@ internal static CosmosQueryResponse<TInput> CreateResponse<TInput>(
CosmosQueryResponse<TInput> queryResponse = new CosmosQueryResponse<TInput>(
hasMoreResults: hasMoreResults,
continuationToken: continuationToken,
disallowContinuationTokenMessage: null);
queryResponse.Resources = resources;
disallowContinuationTokenMessage: null)
{
Resources = resources
};
return queryResponse;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ WHERE c.key = "arrayOnlyKey"]]></Query>
<Query><![CDATA[SELECT VALUE MIN (c.field)
FROM c
WHERE c.key = "oneArrayKey"]]></Query>
<Aggregation><![CDATA[[]]]></Aggregation>
<Aggregation />
</Result>
<Result>
<Query><![CDATA[SELECT VALUE MIN (c.field)
FROM c
WHERE c.key = "oneObjectKey"]]></Query>
<Aggregation><![CDATA[{}]]></Aggregation>
<Aggregation />
</Result>
<Result>
<Query><![CDATA[SELECT VALUE MIN (c.field)
Expand Down Expand Up @@ -291,13 +291,13 @@ WHERE c.key = "arrayOnlyKey"]]></Query>
<Query><![CDATA[SELECT VALUE MAX (c.field)
FROM c
WHERE c.key = "oneArrayKey"]]></Query>
<Aggregation><![CDATA[[]]]></Aggregation>
<Aggregation />
</Result>
<Result>
<Query><![CDATA[SELECT VALUE MAX (c.field)
FROM c
WHERE c.key = "oneObjectKey"]]></Query>
<Aggregation><![CDATA[{}]]></Aggregation>
<Aggregation />
</Result>
<Result>
<Query><![CDATA[SELECT VALUE MAX (c.field)
Expand Down