Query: Fixes GetItemQueryIterator to honor the supplied (optional) FeedRange#5543
Merged
Conversation
adityasa
commented
Dec 19, 2025
adityasa
commented
Dec 19, 2025
adityasa
commented
Dec 19, 2025
adityasa
commented
Dec 21, 2025
adityasa
commented
Dec 21, 2025
adityasa
commented
Dec 21, 2025
Contributor
Author
|
This was referenced Mar 23, 2026
Bump Microsoft.Azure.Cosmos from 3.57.1 to 3.58.0
azureossd/general-database-connectivity-samples#27
Merged
Merged
This was referenced Apr 7, 2026
This was referenced Apr 20, 2026
This was referenced Apr 27, 2026
Open
This was referenced May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Query: Fixes GetItemQueryIterator to honor the supplied (optional) FeedRange
Description
This change supports query execution using serialized FeedRange supplied to GetItemQueryIterator. It limits the query execution to specified feed ranges by using start epk and end epk values.
This is done by adjusting PartitionKeyRange of each partition to be >= min and <= max of the supplied range after target partitions have been identified. While this is not logically accurate, since PartitionKeyRange represents the ranges of a physical partition, and technically there may not be a physical partition with exact ranges after they have been adjusted using user supplied range and (the adjusted range is a subset of a physical partition range), this is rather only a semantic issue. Also, once the target range (adjusted or not) is obtained, they are anyways converted to FeedRangeEpk which represents a slice of a partition.
This logic of "clipping" a partition is similar to what we do in case of Hierarchical partition and we repurpose the existing class for locality of knowledge.
Note: QueryRequestOptions has a FeedRange property. However this is NOT the property that gets used when the GetItemQueryIterator API with FeedRange is called. In fact, QueryRequestOptions.FeedRange is an internal property.
I also explored the option of populating the start-epk and end-epk headers in QueryRequestOptions::PopulateRequestOptions as an alternative to "clipping" the PartitionKeyRange from target ranges.
This has following challenges:
Caveats:
Please note due to the difference in types being utilized internally and externally (deserialized type), we are only able to support feedranges with min being inclusive and max being exclusive - [min, max)
Moreover there is no validation against "unsupported values" and they are automatically interpreted as [min, max).
Type of change
Closing issues
Closes #5451