{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/comments/63341438","id":63341438,"diff_hunk":"@@ -0,0 +1,231 @@\n+// Copyright 2015 PingCAP, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package plan\n+\n+import (\n+\t\"github.com/juju/errors\"\n+\t\"github.com/pingcap/tidb/ast\"\n+)\n+\n+func removePlan(p Plan) error {\n+\tparents := p.GetParents()\n+\tchildren := p.GetChildren()\n+\tif len(parents) != 1 || len(children) != 1 {\n+\t\treturn SystemInternalErrorType.Gen(\"can't remove this plan\")\n+\t}\n+\tparent, child := parents[0], children[0]\n+\terr := parent.ReplaceChild(p, child)\n+\tif err != nil {\n+\t\treturn errors.Trace(err)\n+\t}\n+\terr = child.ReplaceParent(p, parent)\n+\tif err != nil {\n+\t\treturn errors.Trace(err)\n+\t}\n+\treturn nil\n+}\n+\n+func addFilter(p Plan, child Plan, conditions []ast.ExprNode) error {\n+\tfilter := &Filter{Conditions: conditions}\n+\tfilter.AddChild(child)\n+\tfilter.AddParent(p)\n+\terr := child.ReplaceParent(p, filter)\n+\tif err != nil {\n+\t\treturn errors.Trace(err)\n+\t}\n+\terr = p.ReplaceChild(child, filter)\n+\tif err != nil {\n+\t\treturn errors.Trace(err)\n+\t}\n+\treturn nil\n+}\n+\n+type columnSubstitute struct {","path":"optimizer/plan/predicate_push_down.go","position":54,"original_position":54,"commit_id":"b5355a94128efa19f2620689bc4203c276ea1721","original_commit_id":"b5355a94128efa19f2620689bc4203c276ea1721","user":{"login":"coocood","id":891222,"avatar_url":"https://avatars.githubusercontent.com/u/891222?v=3","gravatar_id":"","url":"https://api.github.com/users/coocood","html_url":"https://github.com/coocood","followers_url":"https://api.github.com/users/coocood/followers","following_url":"https://api.github.com/users/coocood/following{/other_user}","gists_url":"https://api.github.com/users/coocood/gists{/gist_id}","starred_url":"https://api.github.com/users/coocood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coocood/subscriptions","organizations_url":"https://api.github.com/users/coocood/orgs","repos_url":"https://api.github.com/users/coocood/repos","events_url":"https://api.github.com/users/coocood/events{/privacy}","received_events_url":"https://api.github.com/users/coocood/received_events","type":"User","site_admin":false},"body":"Add comments for this visitor.","created_at":"2016-05-16T11:39:35Z","updated_at":"2016-05-16T11:39:35Z","html_url":"https://github.com/pingcap/tidb/pull/1234#discussion_r63341438","pull_request_url":"https://api.github.com/repos/pingcap/tidb/pulls/1234","_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/comments/63341438"},"html":{"href":"https://github.com/pingcap/tidb/pull/1234#discussion_r63341438"},"pull_request":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/1234"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/1234","id":70145867,"html_url":"https://github.com/pingcap/tidb/pull/1234","diff_url":"https://github.com/pingcap/tidb/pull/1234.diff","patch_url":"https://github.com/pingcap/tidb/pull/1234.patch","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/1234","number":1234,"state":"open","locked":false,"title":"support hash join in new plan","user":{"login":"hanfei19910905","id":4242394,"avatar_url":"https://avatars.githubusercontent.com/u/4242394?v=3","gravatar_id":"","url":"https://api.github.com/users/hanfei19910905","html_url":"https://github.com/hanfei19910905","followers_url":"https://api.github.com/users/hanfei19910905/followers","following_url":"https://api.github.com/users/hanfei19910905/following{/other_user}","gists_url":"https://api.github.com/users/hanfei19910905/gists{/gist_id}","starred_url":"https://api.github.com/users/hanfei19910905/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanfei19910905/subscriptions","organizations_url":"https://api.github.com/users/hanfei19910905/orgs","repos_url":"https://api.github.com/users/hanfei19910905/repos","events_url":"https://api.github.com/users/hanfei19910905/events{/privacy}","received_events_url":"https://api.github.com/users/hanfei19910905/received_events","type":"User","site_admin":false},"body":"support hash join","created_at":"2016-05-16T03:26:15Z","updated_at":"2016-05-16T11:39:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e088c964b628693dad41fd5b02693d25d1493ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/tidb/pulls/1234/commits","review_comments_url":"https://api.github.com/repos/pingcap/tidb/pulls/1234/comments","review_comment_url":"https://api.github.com/repos/pingcap/tidb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/1234/comments","statuses_url":"https://api.github.com/repos/pingcap/tidb/statuses/b5355a94128efa19f2620689bc4203c276ea1721","head":{"label":"pingcap:hanfei/rewrite_plan","ref":"hanfei/rewrite_plan","sha":"b5355a94128efa19f2620689bc4203c276ea1721","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":41986369,"name":"tidb","full_name":"pingcap/tidb","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tidb","description":"TiDB is a distributed NewSQL database compatible with MySQL protocol ","fork":false,"url":"https://api.github.com/repos/pingcap/tidb","forks_url":"https://api.github.com/repos/pingcap/tidb/forks","keys_url":"https://api.github.com/repos/pingcap/tidb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tidb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tidb/teams","hooks_url":"https://api.github.com/repos/pingcap/tidb/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tidb/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tidb/events","assignees_url":"https://api.github.com/repos/pingcap/tidb/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tidb/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tidb/tags","blobs_url":"https://api.github.com/repos/pingcap/tidb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tidb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tidb/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tidb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tidb/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tidb/languages","stargazers_url":"https://api.github.com/repos/pingcap/tidb/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tidb/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tidb/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tidb/subscription","commits_url":"https://api.github.com/repos/pingcap/tidb/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tidb/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tidb/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tidb/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tidb/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tidb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tidb/merges","archive_url":"https://api.github.com/repos/pingcap/tidb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tidb/downloads","issues_url":"https://api.github.com/repos/pingcap/tidb/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tidb/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tidb/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tidb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tidb/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tidb/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tidb/deployments","created_at":"2015-09-06T04:01:52Z","updated_at":"2016-05-16T10:47:31Z","pushed_at":"2016-05-16T08:32:36Z","git_url":"git://github.com/pingcap/tidb.git","ssh_url":"git@github.com:pingcap/tidb.git","clone_url":"https://github.com/pingcap/tidb.git","svn_url":"https://github.com/pingcap/tidb","homepage":"","size":14611,"stargazers_count":3939,"watchers_count":3939,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":463,"mirror_url":null,"open_issues_count":79,"forks":463,"open_issues":79,"watchers":3939,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"55ed68ca6c8fdb04b321d32d9d545c998e211286","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":41986369,"name":"tidb","full_name":"pingcap/tidb","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tidb","description":"TiDB is a distributed NewSQL database compatible with MySQL protocol ","fork":false,"url":"https://api.github.com/repos/pingcap/tidb","forks_url":"https://api.github.com/repos/pingcap/tidb/forks","keys_url":"https://api.github.com/repos/pingcap/tidb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tidb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tidb/teams","hooks_url":"https://api.github.com/repos/pingcap/tidb/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tidb/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tidb/events","assignees_url":"https://api.github.com/repos/pingcap/tidb/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tidb/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tidb/tags","blobs_url":"https://api.github.com/repos/pingcap/tidb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tidb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tidb/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tidb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tidb/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tidb/languages","stargazers_url":"https://api.github.com/repos/pingcap/tidb/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tidb/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tidb/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tidb/subscription","commits_url":"https://api.github.com/repos/pingcap/tidb/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tidb/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tidb/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tidb/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tidb/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tidb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tidb/merges","archive_url":"https://api.github.com/repos/pingcap/tidb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tidb/downloads","issues_url":"https://api.github.com/repos/pingcap/tidb/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tidb/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tidb/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tidb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tidb/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tidb/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tidb/deployments","created_at":"2015-09-06T04:01:52Z","updated_at":"2016-05-16T10:47:31Z","pushed_at":"2016-05-16T08:32:36Z","git_url":"git://github.com/pingcap/tidb.git","ssh_url":"git@github.com:pingcap/tidb.git","clone_url":"https://github.com/pingcap/tidb.git","svn_url":"https://github.com/pingcap/tidb","homepage":"","size":14611,"stargazers_count":3939,"watchers_count":3939,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":463,"mirror_url":null,"open_issues_count":79,"forks":463,"open_issues":79,"watchers":3939,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/1234"},"html":{"href":"https://github.com/pingcap/tidb/pull/1234"},"issue":{"href":"https://api.github.com/repos/pingcap/tidb/issues/1234"},"comments":{"href":"https://api.github.com/repos/pingcap/tidb/issues/1234/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/1234/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/1234/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/tidb/statuses/b5355a94128efa19f2620689bc4203c276ea1721"}}}}