Fix GroupBy.Select EmptyProjectionMember#38140
Open
henriquewr wants to merge 1 commit intodotnet:mainfrom
Open
Fix GroupBy.Select EmptyProjectionMember#38140henriquewr wants to merge 1 commit intodotnet:mainfrom
henriquewr wants to merge 1 commit intodotnet:mainfrom
Conversation
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.
"partially" fixes #30052, #31209 and probably others
The issue was that the QueryExpression instance is the same reference as the external instance
So the inner projection was wrongly applied to the external too
This fixes the original
EmptyProjectionMembererror, nowGroupBy(...).Select(...).Where(...)(or any method that follows the Select call, as long as it is not other Select call) works, but isn't the entire thingIf the
Selectcall following aGroupByfalls back to_indexBasedBinding(RelationalProjectionBindingExpressionVisitor or InMemory)GroupBy(...).Select(SomethingThatFallsbackToIndexBasing)it is no longer possible to apply any projection that doesn't also falls back to
_indexBasedBindingThis occurs because the second projection cannot override the previous one (
_clientProjectionhas a projection and_projectionMappinghas other projection)It seems that this entire thing is caused because the
GroupByversion ofNavigationExpandingExpressionVisitor.ProcessSelectwhich does not return a pending selector. Instead, it returns a direct Select call that is not extensibleI tested the approach returning a pending selector, which resolved the issue (allowing
GroupBy(...).Select(SomethingThatFallsbackToIndexBasing).Select(...)to work)However doing it generates lots of other problems, it would need a different approach to how pending selectors are handled
Certain methods would need to resolve the pending selector before the call
GroupBy().Select().Join(),Joinwould need to resolve the pending selector before the callAt least a workaround exists:
Instead of chaining Select calls:
You can nest Select calls:
About the skipped InMemory test:
It seems to be caused by the same issue
Is supposed to be transformed into
And since
GroupBy.Selectdoes not return a pending selector, theWherecall fails to retrieve the value