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: Clone shaped query expression during translation #25634

Merged
merged 1 commit into from
Aug 23, 2021

Conversation

smitpatel
Copy link
Contributor

Generally we encounter ShapedQueryExpression during translation when translating subqueries
Since ShapedQueryExpression contains QueryExpression which is mutated in-place, we lose the original expression if for any reason translation doesn't work out. Which blocks us from translating it further without recreating original tree again.
We were hitting this during client eval in projection earlier where owned entities are expanded during translation
We recreated tree by expanding owned navigation during the method to retain original expression
With issue #22089 we ran into situation where we try to translate a subquery which is not fully translatable and then we have to visit it through base.
So to avoid the whole issue with reconstruction, now we clone the shaped query during translation so we never mutate original expression

Resolves #22089

Generally we encounter ShapedQueryExpression during translation when translating subqueries
Since ShapedQueryExpression contains QueryExpression which is mutated in-place, we lose the original expression if for any reason translation doesn't work out. Which blocks us from translating it further without recreating original tree again.
We were hitting this during client eval in projection earlier where owned entities are expanded during translation
We recreated tree by expanding owned navigation during the method to retain original expression
With issue #22089 we ran into situation where we try to translate a subquery which is not fully translatable and then we have to visit it through base.
So to avoid the whole issue with reconstruction, now we clone the shaped query during translation so we never mutate original expression

Resolves #22089
@smitpatel smitpatel requested a review from a team August 20, 2021 21:43
@smitpatel smitpatel merged commit 4f5990b into release/6.0 Aug 23, 2021
@smitpatel smitpatel deleted the smit/skate1 branch August 23, 2021 22:48
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.

OwnsMany projection exception: The given key 'EmptyProjectionMember' was not present in the dictionary
2 participants