-
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 custom aggregate functions without GroupBy #29200
Comments
This seems to be impacting statistical aggregate functions as well. Unless I do a GroupBy, I always get:
|
Also, just attempting to use the aggregate function is enough to force the switch to client evaluation (and fail) even if client eval would not be used without the aggregate. For example: var query = context.Authors
.Select(author => new
{
Author = author,
TotalCost = author.Books.Sum(book => book.Detail.Price),
// VariancePopulation = EF.Functions.VariancePopulation(author.Books.Select(post => post.Detail.Price)),
}); Generates: SELECT [a].[Id], [a].[Name], (
SELECT COALESCE(SUM([b].[Detail_Price]), 0)
FROM [Books] AS [b]
WHERE [a].[Id] = [b].[AuthorId]) AS [TotalCost]
FROM [Authors] AS [a] But uncommenting the function call causes the client-eval warning. |
Right, I think that's expected given there's a translation failure with the custom aggregates (regular switch to client eval on failure in top projection). |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Note from triage: this is a limitation based on the aggregate function having only an |
Another instance: npgsql/efcore.pg#2569 |
Would be nice if this got planned for EF8, seems like one of those things that's pretty basic (in that you would expect it to work as a user), but currently lacking. |
Max can be used over a collection navigation in a projection:
However, the same can't be done with string.Join:
(this causes client evaluation)
The query above can be rewritten using a GroupBy, which does work:
The text was updated successfully, but these errors were encountered: