Skip to content

Query: Support GroupBy when it is final operator #19929

Closed

Description

This issue is about enabling following query

context.Orders.GroupBy(o => o.CustomerID).ToList();

This is NOT about client evaluating when there is any additional operator after GroupBy or result selector is specified in GroupBy.
Examples of disallowed queries where we will NOT client eval GroupBy operator

context.Orders.GroupBy(o => o.CustomerID).Select(g => new { g.Key, OrderDates = g.Select(e => e.OrderDate).ToList()).ToList();
context.Orders.GroupBy(o => o.CustomerID, (k, os) => new { OrderDates = os.Select(e => e.OrderDate).ToList()).ToList();

As of EF Core 3.1 certain constructs of GroupBy where GroupBy is composed over (followed by another queryable operator) is translated. Read our GroupBy operator documentation to understand what is supported scenarios.

There are few other cases, where GroupBy with composition can be translated to server but not yet translated. To list a few

Resolution of this issue only enables client evaluation of GroupBy when it is last operator. Any of the above listed missing features will not work even if this issue is fixed. Please upvote relevant issue from above list which you need in your scenario. Please upvote this issue iff you need client side evaluation of GroupBy operator when it is last operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

area-queryclosed-fixedThe issue has been fixed and is/will be included in the release indicated by the issue milestone.ef6-paritytype-enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions