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: collection join scenario where inner collection is a group by correlated with outer should be detected and blocked #21965

Open
Tracked by #30173
maumar opened this issue Aug 7, 2020 · 0 comments

Comments

@maumar
Copy link
Contributor

maumar commented Aug 7, 2020

Example:

 ctx.Customers.Where(c => c.CustomerID.StartsWith("A"))
    .Select(c => c.Orders.GroupBy(o => o.OrderID).Select(g => g.Key).ToArray());

when processing collection join we try to add correlation predicate columns to the inner projection, however that produces incorrect sql - group by query can only project grouping keys (and aggregates).
Outer key can't be part of the grouping either (Each GROUP BY expression must contain at least one column that is not an outer reference.)

Uncorrelated group by subqueries should still work.

@maumar maumar changed the title Query: collection join scenario where inner collection is a grou by query correlated with outer should be detected and blocked Query: collection join scenario where inner collection is a group by correlated with outer should be detected and blocked Aug 7, 2020
@ajcvickers ajcvickers added this to the Backlog milestone Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants