Skip to content
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
merged 13 commits into from
Jan 22, 2021

Conversation

bchong95
Copy link
Contributor

@bchong95 bchong95 commented Jan 5, 2021

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.

@bchong95 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
sboshra previously approved these changes Jan 22, 2021
@sboshra sboshra merged commit a17dba2 into master Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants