Skip to content

Query: Clone shaped query expression during translation - #25634

Merged
smitpatel merged 1 commit into
release/6.0from
smit/skate1
Aug 23, 2021
Merged

smitpatel merged 1 commit into
release/6.0from
smit/skate1

Conversation

@smitpatel

Copy link
Copy Markdown
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