{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/7700","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/7700/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/7700/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/7700/events","html_url":"https://github.com/pingcap/tidb/issues/7700","id":360177588,"node_id":"MDU6SXNzdWUzNjAxNzc1ODg=","number":7700,"title":"enhance the rule of \"Group Pruning\"","user":{"login":"zz-jason","id":5268763,"node_id":"MDQ6VXNlcjUyNjg3NjM=","avatar_url":"https://avatars0.githubusercontent.com/u/5268763?v=4","gravatar_id":"","url":"https://api.github.com/users/zz-jason","html_url":"https://github.com/zz-jason","followers_url":"https://api.github.com/users/zz-jason/followers","following_url":"https://api.github.com/users/zz-jason/following{/other_user}","gists_url":"https://api.github.com/users/zz-jason/gists{/gist_id}","starred_url":"https://api.github.com/users/zz-jason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zz-jason/subscriptions","organizations_url":"https://api.github.com/users/zz-jason/orgs","repos_url":"https://api.github.com/users/zz-jason/repos","events_url":"https://api.github.com/users/zz-jason/events{/privacy}","received_events_url":"https://api.github.com/users/zz-jason/received_events","type":"User","site_admin":false},"labels":[{"id":667671533,"node_id":"MDU6TGFiZWw2Njc2NzE1MzM=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/planner","name":"component/planner","color":"1d76db","default":false},{"id":256872088,"node_id":"MDU6TGFiZWwyNTY4NzIwODg=","url":"https://api.github.com/repos/pingcap/tidb/labels/type/enhancement","name":"type/enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/pingcap/tidb/milestones/11","html_url":"https://github.com/pingcap/tidb/milestone/11","labels_url":"https://api.github.com/repos/pingcap/tidb/milestones/11/labels","id":3254588,"node_id":"MDk6TWlsZXN0b25lMzI1NDU4OA==","number":11,"title":"2.1","description":"","creator":{"login":"shenli","id":1192573,"node_id":"MDQ6VXNlcjExOTI1NzM=","avatar_url":"https://avatars0.githubusercontent.com/u/1192573?v=4","gravatar_id":"","url":"https://api.github.com/users/shenli","html_url":"https://github.com/shenli","followers_url":"https://api.github.com/users/shenli/followers","following_url":"https://api.github.com/users/shenli/following{/other_user}","gists_url":"https://api.github.com/users/shenli/gists{/gist_id}","starred_url":"https://api.github.com/users/shenli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shenli/subscriptions","organizations_url":"https://api.github.com/users/shenli/orgs","repos_url":"https://api.github.com/users/shenli/repos","events_url":"https://api.github.com/users/shenli/events{/privacy}","received_events_url":"https://api.github.com/users/shenli/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":57,"state":"open","created_at":"2018-04-10T03:42:16Z","updated_at":"2018-10-23T09:15:50Z","due_on":"2018-07-31T07:00:00Z","closed_at":null},"comments":1,"created_at":"2018-09-14T06:48:45Z","updated_at":"2018-12-19T16:07:25Z","closed_at":null,"author_association":"MEMBER","body":"## Feature Request\r\n\r\n**Describe the feature you'd like:**\r\n\r\nrefer to this blog post: https://blogs.oracle.com/optimizer/group-by-and-aggregation-elimination\r\n\r\nGroup pruning is a transformation rule, which is always beneficial. It removes the groups not needed in the outer query blocks. For example, consider the following query:\r\n\r\n```sql\r\nTiDB(localhost:4000) > desc select max(b), sum(sum_c) from (select a, b, sum(c) as sum_c from t group by a, b) tmp group by a;\r\n+--------------------------+----------+------+------------------------------------------------------------------------------------------+\r\n| id                       | count    | task | operator info                                                                            |\r\n+--------------------------+----------+------+------------------------------------------------------------------------------------------+\r\n| HashAgg_9                | 8000.00  | root | group by:test.t.a, funcs:max(test.t.b), sum(sum_c)                                       |\r\n| └─HashAgg_14             | 8000.00  | root | group by:col_3, col_4, funcs:sum(col_0), firstrow(col_1), firstrow(col_2)                |\r\n|   └─TableReader_15       | 8000.00  | root | data:HashAgg_10                                                                          |\r\n|     └─HashAgg_10         | 8000.00  | cop  | group by:test.t.a, test.t.b, funcs:sum(test.t.c), firstrow(test.t.a), firstrow(test.t.b) |\r\n|       └─TableScan_13     | 10000.00 | cop  | table:t, range:[-inf,+inf], keep order:false, stats:pseudo                               |\r\n+--------------------------+----------+------+------------------------------------------------------------------------------------------+\r\n5 rows in set (0.01 sec)\r\n```\r\n\r\nCan be transformed into something like this:\r\n```sql\r\nTiDB(localhost:4000) > desc select max(b), sum(c) from t group by a;\r\n+-----------------------+----------+------+------------------------------------------------------------+\r\n| id                    | count    | task | operator info                                              |\r\n+-----------------------+----------+------+------------------------------------------------------------+\r\n| HashAgg_9             | 8000.00  | root | group by:col_2, funcs:max(col_0), sum(col_1)               |\r\n| └─TableReader_10      | 8000.00  | root | data:HashAgg_5                                             |\r\n|   └─HashAgg_5         | 8000.00  | cop  | group by:test.t.a, funcs:max(test.t.b), sum(test.t.c)      |\r\n|     └─TableScan_8     | 10000.00 | cop  | table:t, range:[-inf,+inf], keep order:false, stats:pseudo |\r\n+-----------------------+----------+------+------------------------------------------------------------+\r\n4 rows in set (0.00 sec)\r\n```"},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/448649674","html_url":"https://github.com/pingcap/tidb/issues/7700#issuecomment-448649674","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/7700","id":448649674,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODY0OTY3NA==","user":{"login":"zz-jason","id":5268763,"node_id":"MDQ6VXNlcjUyNjg3NjM=","avatar_url":"https://avatars0.githubusercontent.com/u/5268763?v=4","gravatar_id":"","url":"https://api.github.com/users/zz-jason","html_url":"https://github.com/zz-jason","followers_url":"https://api.github.com/users/zz-jason/followers","following_url":"https://api.github.com/users/zz-jason/following{/other_user}","gists_url":"https://api.github.com/users/zz-jason/gists{/gist_id}","starred_url":"https://api.github.com/users/zz-jason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zz-jason/subscriptions","organizations_url":"https://api.github.com/users/zz-jason/orgs","repos_url":"https://api.github.com/users/zz-jason/repos","events_url":"https://api.github.com/users/zz-jason/events{/privacy}","received_events_url":"https://api.github.com/users/zz-jason/received_events","type":"User","site_admin":false},"created_at":"2018-12-19T16:07:25Z","updated_at":"2018-12-19T16:07:25Z","author_association":"MEMBER","body":"> Looks very interesting, I will try to implement this rule.\r\n\r\nNice to hear that! Thanks for your help! 😄 "}}
{"actor":{"display_login":"zz-jason"}}