-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Translate GroupBy after Join with aggregate in projection #13629
Comments
I can confirm the bug. |
Yes Yes. source: |
@gongjie18675517757 Can you please post a runnable project/solution or complete code listing that demonstrates the behavior you are seeing? |
@ajcvickers
|
@ajcvickers
should sql is :
actually sql is :
then group by in memory |
@gongjie18675517757 From running the code, I see warnings and get the correct results. So it looks like it is being client-evaluated and returns the correct results. Translating this is considered an enhancement rather than a bug fix, unless I am missing some other way that this is a bug.
|
@ajcvickers |
Hi, so, the query can be translate in this way:
Sorry, I do not have time to create a whole project. :-( P.S. as @gongjie18675517757 said, in the documentation the developer team wrote: A group by after a simple join is a common case IMHO. :-) |
@gongjie18675517757 Agreed, but that is not implemented yet, which is why this is an open issue. @lfongaroScp If you are seeing something different, then please file a new issue with a complete description and a runnable project/solution or complete code listing to reproduce the issue. Without that there isn't much we can do. |
Possibly related to #13887 |
This is likely fixed in 3.0 |
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Join_GroupBy_Aggregate(bool isAsync)
{
return AssertQuery<Order, Customer>(
isAsync,
(os, cs) =>
(from o in os
join c in cs
on o.CustomerID equals c.CustomerID
group o by c.CustomerID)
.Select(
g => new
{
g.Key,
Count = g.Average(o => o.OrderID)
}),
e => e.Key);
} Generates SELECT [c].[CustomerID] AS [Key], AVG(CAST([o].[OrderID] AS float)) AS [Count]
FROM [Orders] AS [o]
INNER JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID]
GROUP BY [c].[CustomerID] |
Note: works fine in a single table
Exception: Working abnormally when using multiple tables to associate queries (EF 6.0 is normal)
example:
The text was updated successfully, but these errors were encountered: