-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query: Fixes ORDER BY undefined (and mixed type primitives) continuation token support #2103
Merged
sboshra
merged 13 commits into
master
from
users/brchon/OrderByUndefinedContinuationTokens
Jan 22, 2021
Merged
Query: Fixes ORDER BY undefined (and mixed type primitives) continuation token support #2103
sboshra
merged 13 commits into
master
from
users/brchon/OrderByUndefinedContinuationTokens
Jan 22, 2021
Conversation
This file contains 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
bchong95
requested review from
j82w,
kirankumarkolli and
sboshra
as code owners
January 5, 2021 00:39
j82w
reviewed
Jan 5, 2021
...os/src/Query/Core/Pipeline/CrossPartition/OrderBy/OrderByCrossPartitionQueryPipelineStage.cs
Outdated
Show resolved
Hide resolved
…ps://github.com/Azure/azure-cosmos-dotnet-v3 into users/brchon/OrderByUndefinedContinuationTokens
bchong95
requested review from
ealsur,
FabianMeiswinkel,
khdang and
kirillg
as code owners
January 6, 2021 00:09
bchong95
changed the title
Query: Fixes ORDER BY undefined continuation token support
Query: Fixes ORDER BY undefined (and mixed type primitives) continuation token support
Jan 11, 2021
sboshra
reviewed
Jan 22, 2021
...os/src/Query/Core/Pipeline/CrossPartition/OrderBy/OrderByCrossPartitionQueryPipelineStage.cs
Outdated
Show resolved
Hide resolved
sboshra
reviewed
Jan 22, 2021
...os/src/Query/Core/Pipeline/CrossPartition/OrderBy/OrderByCrossPartitionQueryPipelineStage.cs
Outdated
Show resolved
Hide resolved
sboshra
reviewed
Jan 22, 2021
...os/src/Query/Core/Pipeline/CrossPartition/OrderBy/OrderByCrossPartitionQueryPipelineStage.cs
Outdated
Show resolved
Hide resolved
sboshra
previously approved these changes
Jan 22, 2021
sboshra
approved these changes
Jan 22, 2021
This was referenced Mar 8, 2021
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 ORDER BY undefined continuation token support
Description
For ORDER BY queries we only store the continuation token for the partition we are resuming on. For the other partitions (left of target and right of target) we generate a filter that mimics the resume term. The problem here is that we didn't account for the undefined case when writing our visitor pattern. The following code results in a NullReferenceException:
orderByItem.Accept(cosmosElementToQueryLiteral);
Since
orderByItem
is null.One solution to avoid the NRE is to use the
undefined
literal in the filter. Unfortunately this would lead to correctness issues, since comparing against undefined like so:c.item > undefined
is also undefined. leading to the entire query returning no results.
So the solution is to use the
IS_DEFINED
system function to remove the undefined fields when needed.