Cosmos: Fixes around array projection#34061
Merged
roji merged 1 commit intodotnet:mainfrom Jun 24, 2024
Merged
Conversation
4da4950 to
3fe7200
Compare
Comment on lines
+1792
to
+1795
| SELECT VALUE i | ||
| FROM i IN c["Ints"]), |
Member
There was a problem hiding this comment.
Wasn't c["Ints"] a better translation?
Member
Author
There was a problem hiding this comment.
Yeah, it was - this is the result of composing ToList() on top of a bare array (ToList() is one of the major things enabled by this PR)... This is actually quite complicated, since the CLR type of the array (int[]) can't just be cast (in the shaper) to a List<int>.
FWIW the same thing happens in relational - if you look at the SQL Server SQL baseline for this same test you'll see OUTER APPLY OPENJSON([p].[Ints]) AS [i], although we could have just projected [p].[Ints] directly and parsed the JSON... It's indeed an unfortunate edge-case - opened #34081 to track improving it across both relational and Cosmos.
AndriySvyryd
approved these changes
Jun 24, 2024
3fe7200 to
227fa59
Compare
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.
Along with #34008, this should complete the collection projection story (though I still have a few things left to investigate).
I'm not super happy with the way things work, but this is more or less aligned with the relational behavior, and mostly works... I can see potential for cleanup and improvements in the future, but I've already spent enough time on it...
Closes #33797