{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto/pulls/comments/193812210","pull_request_review_id":126556911,"id":193812210,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzgxMjIxMA==","diff_hunk":"@@ -0,0 +1,120 @@\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+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.facebook.presto.sql.planner.iterative.rule;\n+\n+import com.facebook.presto.sql.planner.Symbol;\n+import com.facebook.presto.sql.planner.iterative.Lookup;\n+import com.facebook.presto.sql.planner.plan.JoinNode;\n+import com.facebook.presto.sql.planner.plan.PlanNode;\n+import com.facebook.presto.sql.tree.Expression;\n+import com.google.common.collect.ImmutableList;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import static com.facebook.presto.sql.ExpressionUtils.and;\n+import static com.facebook.presto.sql.planner.DeterminismEvaluator.isDeterministic;\n+import static com.facebook.presto.sql.planner.plan.JoinNode.Type.INNER;\n+import static com.facebook.presto.sql.tree.BooleanLiteral.TRUE_LITERAL;\n+import static com.google.common.base.Preconditions.checkArgument;\n+import static com.google.common.base.Preconditions.checkState;\n+import static com.google.common.collect.ImmutableList.toImmutableList;\n+import static java.util.Objects.requireNonNull;\n+\n+/**\n+ * This class represents a set of inner joins that can be executed in any order.\n+ */\n+class MultiJoinNode\n+{\n+    private final List<PlanNode> sources;\n+    private final Expression filter;\n+    private final List<Symbol> outputSymbols;\n+\n+    public MultiJoinNode(List<PlanNode> sources, Expression filter, List<Symbol> outputSymbols)\n+    {\n+        this.sources = ImmutableList.copyOf(requireNonNull(sources, \"sources is null\"));\n+        this.filter = requireNonNull(filter, \"filter is null\");\n+        this.outputSymbols = ImmutableList.copyOf(requireNonNull(outputSymbols, \"outputSymbols is null\"));\n+\n+        List<Symbol> inputSymbols = sources.stream().flatMap(source -> source.getOutputSymbols().stream()).collect(toImmutableList());\n+        checkArgument(inputSymbols.containsAll(outputSymbols), \"inputs do not contain all output symbols\");\n+    }\n+\n+    public Expression getFilter()\n+    {\n+        return filter;\n+    }\n+\n+    public List<PlanNode> getSources()\n+    {\n+        return sources;\n+    }\n+\n+    public List<Symbol> getOutputSymbols()\n+    {\n+        return outputSymbols;\n+    }\n+\n+    static MultiJoinNode toMultiJoinNode(JoinNode joinNode, Lookup lookup, int joinLimit)\n+    {\n+        return new MultiJoinNodeBuilder(joinNode, lookup, joinLimit).toMultiJoinNode();\n+    }\n+\n+    private static class MultiJoinNodeBuilder\n+    {\n+        private final List<PlanNode> sources = new ArrayList<>();","path":"presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/MultiJoinNode.java","position":77,"original_position":77,"commit_id":"ee0c5e5a5f907c7693b076378fc844f16f6f59e9","original_commit_id":"9abaa05bdb217f5d2af918859a77b83ccdaa2d34","user":{"login":"rschlussel2","id":34256034,"node_id":"MDQ6VXNlcjM0MjU2MDM0","avatar_url":"https://avatars1.githubusercontent.com/u/34256034?v=4","gravatar_id":"","url":"https://api.github.com/users/rschlussel2","html_url":"https://github.com/rschlussel2","followers_url":"https://api.github.com/users/rschlussel2/followers","following_url":"https://api.github.com/users/rschlussel2/following{/other_user}","gists_url":"https://api.github.com/users/rschlussel2/gists{/gist_id}","starred_url":"https://api.github.com/users/rschlussel2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rschlussel2/subscriptions","organizations_url":"https://api.github.com/users/rschlussel2/orgs","repos_url":"https://api.github.com/users/rschlussel2/repos","events_url":"https://api.github.com/users/rschlussel2/events{/privacy}","received_events_url":"https://api.github.com/users/rschlussel2/received_events","type":"User","site_admin":false},"body":"You can't get the size if everything is in a builder.","created_at":"2018-06-07T16:30:08Z","updated_at":"2018-06-07T16:32:49Z","html_url":"https://github.com/prestodb/presto/pull/10753#discussion_r193812210","pull_request_url":"https://api.github.com/repos/prestodb/presto/pulls/10753","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments/193812210"},"html":{"href":"https://github.com/prestodb/presto/pull/10753#discussion_r193812210"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10753"}},"in_reply_to_id":193203183},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/10753","id":192505061,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyNTA1MDYx","html_url":"https://github.com/prestodb/presto/pull/10753","diff_url":"https://github.com/prestodb/presto/pull/10753.diff","patch_url":"https://github.com/prestodb/presto/pull/10753.patch","issue_url":"https://api.github.com/repos/prestodb/presto/issues/10753","number":10753,"state":"open","locked":false,"title":"Cost-based reorder joins","user":{"login":"findepi","id":144328,"node_id":"MDQ6VXNlcjE0NDMyOA==","avatar_url":"https://avatars0.githubusercontent.com/u/144328?v=4","gravatar_id":"","url":"https://api.github.com/users/findepi","html_url":"https://github.com/findepi","followers_url":"https://api.github.com/users/findepi/followers","following_url":"https://api.github.com/users/findepi/following{/other_user}","gists_url":"https://api.github.com/users/findepi/gists{/gist_id}","starred_url":"https://api.github.com/users/findepi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/findepi/subscriptions","organizations_url":"https://api.github.com/users/findepi/orgs","repos_url":"https://api.github.com/users/findepi/repos","events_url":"https://api.github.com/users/findepi/events{/privacy}","received_events_url":"https://api.github.com/users/findepi/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-04T19:29:35Z","updated_at":"2018-06-07T16:32:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fcd4d4709c478ca3358443211507fdd915f44fa3","assignee":null,"assignees":[],"requested_reviewers":[{"login":"sopel39","id":5989165,"node_id":"MDQ6VXNlcjU5ODkxNjU=","avatar_url":"https://avatars1.githubusercontent.com/u/5989165?v=4","gravatar_id":"","url":"https://api.github.com/users/sopel39","html_url":"https://github.com/sopel39","followers_url":"https://api.github.com/users/sopel39/followers","following_url":"https://api.github.com/users/sopel39/following{/other_user}","gists_url":"https://api.github.com/users/sopel39/gists{/gist_id}","starred_url":"https://api.github.com/users/sopel39/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sopel39/subscriptions","organizations_url":"https://api.github.com/users/sopel39/orgs","repos_url":"https://api.github.com/users/sopel39/repos","events_url":"https://api.github.com/users/sopel39/events{/privacy}","received_events_url":"https://api.github.com/users/sopel39/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":196992743,"node_id":"MDU6TGFiZWwxOTY5OTI3NDM=","url":"https://api.github.com/repos/prestodb/presto/labels/CLA%20Signed","name":"CLA Signed","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/prestodb/presto/pulls/10753/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto/pulls/10753/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/10753/comments","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/ee0c5e5a5f907c7693b076378fc844f16f6f59e9","head":{"label":"starburstdata:epic/cbo/pr/reorder-joins","ref":"epic/cbo/pr/reorder-joins","sha":"ee0c5e5a5f907c7693b076378fc844f16f6f59e9","user":{"login":"starburstdata","id":33209422,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMjA5NDIy","avatar_url":"https://avatars3.githubusercontent.com/u/33209422?v=4","gravatar_id":"","url":"https://api.github.com/users/starburstdata","html_url":"https://github.com/starburstdata","followers_url":"https://api.github.com/users/starburstdata/followers","following_url":"https://api.github.com/users/starburstdata/following{/other_user}","gists_url":"https://api.github.com/users/starburstdata/gists{/gist_id}","starred_url":"https://api.github.com/users/starburstdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starburstdata/subscriptions","organizations_url":"https://api.github.com/users/starburstdata/orgs","repos_url":"https://api.github.com/users/starburstdata/repos","events_url":"https://api.github.com/users/starburstdata/events{/privacy}","received_events_url":"https://api.github.com/users/starburstdata/received_events","type":"Organization","site_admin":false},"repo":{"id":108882128,"node_id":"MDEwOlJlcG9zaXRvcnkxMDg4ODIxMjg=","name":"presto","full_name":"starburstdata/presto","owner":{"login":"starburstdata","id":33209422,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMjA5NDIy","avatar_url":"https://avatars3.githubusercontent.com/u/33209422?v=4","gravatar_id":"","url":"https://api.github.com/users/starburstdata","html_url":"https://github.com/starburstdata","followers_url":"https://api.github.com/users/starburstdata/followers","following_url":"https://api.github.com/users/starburstdata/following{/other_user}","gists_url":"https://api.github.com/users/starburstdata/gists{/gist_id}","starred_url":"https://api.github.com/users/starburstdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/starburstdata/subscriptions","organizations_url":"https://api.github.com/users/starburstdata/orgs","repos_url":"https://api.github.com/users/starburstdata/repos","events_url":"https://api.github.com/users/starburstdata/events{/privacy}","received_events_url":"https://api.github.com/users/starburstdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/starburstdata/presto","description":"Starburst Enterprise Distribution of Presto","fork":true,"url":"https://api.github.com/repos/starburstdata/presto","forks_url":"https://api.github.com/repos/starburstdata/presto/forks","keys_url":"https://api.github.com/repos/starburstdata/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/starburstdata/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/starburstdata/presto/teams","hooks_url":"https://api.github.com/repos/starburstdata/presto/hooks","issue_events_url":"https://api.github.com/repos/starburstdata/presto/issues/events{/number}","events_url":"https://api.github.com/repos/starburstdata/presto/events","assignees_url":"https://api.github.com/repos/starburstdata/presto/assignees{/user}","branches_url":"https://api.github.com/repos/starburstdata/presto/branches{/branch}","tags_url":"https://api.github.com/repos/starburstdata/presto/tags","blobs_url":"https://api.github.com/repos/starburstdata/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/starburstdata/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/starburstdata/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/starburstdata/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/starburstdata/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/starburstdata/presto/languages","stargazers_url":"https://api.github.com/repos/starburstdata/presto/stargazers","contributors_url":"https://api.github.com/repos/starburstdata/presto/contributors","subscribers_url":"https://api.github.com/repos/starburstdata/presto/subscribers","subscription_url":"https://api.github.com/repos/starburstdata/presto/subscription","commits_url":"https://api.github.com/repos/starburstdata/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/starburstdata/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/starburstdata/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/starburstdata/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/starburstdata/presto/contents/{+path}","compare_url":"https://api.github.com/repos/starburstdata/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/starburstdata/presto/merges","archive_url":"https://api.github.com/repos/starburstdata/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/starburstdata/presto/downloads","issues_url":"https://api.github.com/repos/starburstdata/presto/issues{/number}","pulls_url":"https://api.github.com/repos/starburstdata/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/starburstdata/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/starburstdata/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/starburstdata/presto/labels{/name}","releases_url":"https://api.github.com/repos/starburstdata/presto/releases{/id}","deployments_url":"https://api.github.com/repos/starburstdata/presto/deployments","created_at":"2017-10-30T17:05:09Z","updated_at":"2018-06-07T14:42:21Z","pushed_at":"2018-06-07T15:13:13Z","git_url":"git://github.com/starburstdata/presto.git","ssh_url":"git@github.com:starburstdata/presto.git","clone_url":"https://github.com/starburstdata/presto.git","svn_url":"https://github.com/starburstdata/presto","homepage":"https://www.starburstdata.com","size":96769,"stargazers_count":28,"watchers_count":28,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":3,"watchers":28,"default_branch":"master"}},"base":{"label":"prestodb:master","ref":"master","sha":"ba45308c702cd269c6515cf314886781f4ae5bdd","user":{"login":"prestodb","id":6882181,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4ODIxODE=","avatar_url":"https://avatars0.githubusercontent.com/u/6882181?v=4","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"repo":{"id":5349565,"node_id":"MDEwOlJlcG9zaXRvcnk1MzQ5NTY1","name":"presto","full_name":"prestodb/presto","owner":{"login":"prestodb","id":6882181,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY4ODIxODE=","avatar_url":"https://avatars0.githubusercontent.com/u/6882181?v=4","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prestodb/presto","description":"Distributed SQL query engine for big data","fork":false,"url":"https://api.github.com/repos/prestodb/presto","forks_url":"https://api.github.com/repos/prestodb/presto/forks","keys_url":"https://api.github.com/repos/prestodb/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prestodb/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prestodb/presto/teams","hooks_url":"https://api.github.com/repos/prestodb/presto/hooks","issue_events_url":"https://api.github.com/repos/prestodb/presto/issues/events{/number}","events_url":"https://api.github.com/repos/prestodb/presto/events","assignees_url":"https://api.github.com/repos/prestodb/presto/assignees{/user}","branches_url":"https://api.github.com/repos/prestodb/presto/branches{/branch}","tags_url":"https://api.github.com/repos/prestodb/presto/tags","blobs_url":"https://api.github.com/repos/prestodb/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prestodb/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prestodb/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/prestodb/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/prestodb/presto/languages","stargazers_url":"https://api.github.com/repos/prestodb/presto/stargazers","contributors_url":"https://api.github.com/repos/prestodb/presto/contributors","subscribers_url":"https://api.github.com/repos/prestodb/presto/subscribers","subscription_url":"https://api.github.com/repos/prestodb/presto/subscription","commits_url":"https://api.github.com/repos/prestodb/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/prestodb/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/prestodb/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/prestodb/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/prestodb/presto/contents/{+path}","compare_url":"https://api.github.com/repos/prestodb/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prestodb/presto/merges","archive_url":"https://api.github.com/repos/prestodb/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prestodb/presto/downloads","issues_url":"https://api.github.com/repos/prestodb/presto/issues{/number}","pulls_url":"https://api.github.com/repos/prestodb/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/prestodb/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/prestodb/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prestodb/presto/labels{/name}","releases_url":"https://api.github.com/repos/prestodb/presto/releases{/id}","deployments_url":"https://api.github.com/repos/prestodb/presto/deployments","created_at":"2012-08-09T01:03:37Z","updated_at":"2018-06-07T14:37:15Z","pushed_at":"2018-06-07T16:24:09Z","git_url":"git://github.com/prestodb/presto.git","ssh_url":"git@github.com:prestodb/presto.git","clone_url":"https://github.com/prestodb/presto.git","svn_url":"https://github.com/prestodb/presto","homepage":"https://prestodb.io","size":92188,"stargazers_count":7605,"watchers_count":7605,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2554,"mirror_url":null,"archived":false,"open_issues_count":1298,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2554,"open_issues":1298,"watchers":7605,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10753"},"html":{"href":"https://github.com/prestodb/presto/pull/10753"},"issue":{"href":"https://api.github.com/repos/prestodb/presto/issues/10753"},"comments":{"href":"https://api.github.com/repos/prestodb/presto/issues/10753/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10753/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10753/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto/statuses/ee0c5e5a5f907c7693b076378fc844f16f6f59e9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"rschlussel2"}}