{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/11813","repository_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore","labels_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/11813/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/11813/comments","events_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/11813/events","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/11813","id":317812025,"node_id":"MDU6SXNzdWUzMTc4MTIwMjU=","number":11813,"title":"Query: GroupBy with aggregation on navigation property evaluated on the client ","user":{"login":"kosinsky","id":4909055,"node_id":"MDQ6VXNlcjQ5MDkwNTU=","avatar_url":"https://avatars3.githubusercontent.com/u/4909055?v=4","gravatar_id":"","url":"https://api.github.com/users/kosinsky","html_url":"https://github.com/kosinsky","followers_url":"https://api.github.com/users/kosinsky/followers","following_url":"https://api.github.com/users/kosinsky/following{/other_user}","gists_url":"https://api.github.com/users/kosinsky/gists{/gist_id}","starred_url":"https://api.github.com/users/kosinsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosinsky/subscriptions","organizations_url":"https://api.github.com/users/kosinsky/orgs","repos_url":"https://api.github.com/users/kosinsky/repos","events_url":"https://api.github.com/users/kosinsky/events{/privacy}","received_events_url":"https://api.github.com/users/kosinsky/received_events","type":"User","site_admin":false},"labels":[{"id":932828958,"node_id":"MDU6TGFiZWw5MzI4Mjg5NTg=","url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/labels/consider-for-release-notes","name":"consider-for-release-notes","color":"bf4024","default":false},{"id":76481854,"node_id":"MDU6TGFiZWw3NjQ4MTg1NA==","url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/labels/type-enhancement","name":"type-enhancement","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-04-25T22:11:19Z","updated_at":"2018-12-12T00:09:09Z","closed_at":null,"author_association":"NONE","body":"Navigation members  in GroupBy or just in aggregation expressions executed server side, however if you use GroupBy and aggregation for navigation member it happens client side.\r\n\r\n### Steps to reproduce\r\nGroupByQuerySqlServerTest.GroupBy_with_aggregate_through_navigation_property shows the issue\r\n```c#\r\n        public override void GroupBy_with_aggregate_through_navigation_property()\r\n        {\r\n            base.GroupBy_with_aggregate_through_navigation_property();\r\n\r\n            AssertSql(\r\n                @\"SELECT [c].[OrderID], [c].[CustomerID], [c].[EmployeeID], [c].[OrderDate]\r\nFROM [Orders] AS [c]\r\nORDER BY [c].[EmployeeID]\",\r\n                //\r\n                @\"SELECT [i.Customer0].[CustomerID], [i.Customer0].[Region]\r\nFROM [Customers] AS [i.Customer0]\",\r\n                //\r\n                @\"SELECT [i.Customer0].[CustomerID], [i.Customer0].[Region]\r\nFROM [Customers] AS [i.Customer0]\");\r\n        }\r\n        [ConditionalFact]\r\n        public virtual void GroupBy_with_aggregate_through_navigation_property()\r\n        {\r\n            AssertQuery<Order>(\r\n                os => os.GroupBy(c => c.EmployeeID).Select(g => new { max = g.Max(i => i.Customer.Region) }),\r\n                elementSorter: e => e.max);\r\n        }\r\n```\r\nHowever, proper SQL should look like\r\nSELECT [o].[EmployeeID],  MAX([o.Customer].[Region]) AS [Region]\r\nFROM [Orders] AS [o]\r\nINNER JOIN [Customers] AS [o.Customer]  ON [o].[CustomerID] = [od.Customer].[CustoemrID]\r\nGROUP BY [o].[EmployeeID]\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/comments/446411655","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/11813#issuecomment-446411655","issue_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/11813","id":446411655,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjQxMTY1NQ==","user":{"login":"divega","id":1253414,"node_id":"MDQ6VXNlcjEyNTM0MTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1253414?v=4","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"created_at":"2018-12-12T00:09:09Z","updated_at":"2018-12-12T00:09:09Z","author_association":"MEMBER","body":"Clearing up milestone since I think I heard @smitpatel say that this kind of query will be translate in 3.0."}}
{"actor":{"display_login":"divega"}}