{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/8828","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/8828/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/8828/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/8828/events","html_url":"https://github.com/pingcap/tidb/pull/8828","id":394079603,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwOTEzMDE5","number":8828,"title":"planner, executor: add post-process after physical plan optimization and move buildProjBelowAgg from executor to planner","user":{"login":"qw4990","id":7499936,"node_id":"MDQ6VXNlcjc0OTk5MzY=","avatar_url":"https://avatars3.githubusercontent.com/u/7499936?v=4","gravatar_id":"","url":"https://api.github.com/users/qw4990","html_url":"https://github.com/qw4990","followers_url":"https://api.github.com/users/qw4990/followers","following_url":"https://api.github.com/users/qw4990/following{/other_user}","gists_url":"https://api.github.com/users/qw4990/gists{/gist_id}","starred_url":"https://api.github.com/users/qw4990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qw4990/subscriptions","organizations_url":"https://api.github.com/users/qw4990/orgs","repos_url":"https://api.github.com/users/qw4990/repos","events_url":"https://api.github.com/users/qw4990/events{/privacy}","received_events_url":"https://api.github.com/users/qw4990/received_events","type":"User","site_admin":false},"labels":[{"id":970807266,"node_id":"MDU6TGFiZWw5NzA4MDcyNjY=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/executor","name":"component/executor","color":"000000","default":false},{"id":667671533,"node_id":"MDU6TGFiZWw2Njc2NzE1MzM=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/planner","name":"component/planner","color":"1d76db","default":false},{"id":564600738,"node_id":"MDU6TGFiZWw1NjQ2MDA3Mzg=","url":"https://api.github.com/repos/pingcap/tidb/labels/status/LGT2","name":"status/LGT2","color":"5319e7","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":null,"comments":2,"created_at":"2018-12-26T04:31:22Z","updated_at":"2019-01-03T08:03:24Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/8828","html_url":"https://github.com/pingcap/tidb/pull/8828","diff_url":"https://github.com/pingcap/tidb/pull/8828.diff","patch_url":"https://github.com/pingcap/tidb/pull/8828.patch"},"body":"<!--\r\nThank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.\r\n-->\r\n\r\n### What problem does this PR solve? <!--add issue link with summary if exists-->\r\n\r\nAdd a post process function after DoOptimize() in package \"planner/core\". (#8713)\r\nIn this post process, we can:\r\n\r\n1. eliminate physical projection eliminatePhysicalProjection;\r\n2. build projection operator below aggregation operator;\r\n\r\nSo after this code change, the plan in explain xx is equals to explain analyze xx, and the plan generation is back to the \"planner\" package.\r\n\r\nHope this can make the code more readable and maintainable.\r\n\r\n\r\n### What is changed and how it works?\r\n\r\n1. add a postOptimize() after DoOptimize() at planner/core/optimizer.go;\r\n2. move buildProjBelowAgg() from executor/builder.go to planner/core/optimizer.go;\r\n3. update some unit tests;\r\n\r\n### Check List <!--REMOVE the items that are not applicable-->\r\n\r\nTests <!-- At least one of them must be included. -->\r\n\r\n - Unit test\r\n - Integration test\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/pingcap/tidb/8828)\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/451075822","html_url":"https://github.com/pingcap/tidb/pull/8828#issuecomment-451075822","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/8828","id":451075822,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTA3NTgyMg==","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":"2019-01-03T08:03:24Z","updated_at":"2019-01-03T08:03:24Z","author_association":"MEMBER","body":"/run-all-tests "}}
{"actor":{"display_login":"zz-jason"}}