{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto/pulls/comments/214220566","pull_request_review_id":151226828,"id":214220566,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDIyMDU2Ng==","diff_hunk":"@@ -0,0 +1,107 @@\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.optimizations;\n+\n+import com.facebook.presto.Session;\n+import com.facebook.presto.sql.analyzer.FeaturesConfig.JoinDistributionType;\n+import com.facebook.presto.sql.analyzer.FeaturesConfig.JoinReorderingStrategy;\n+import com.facebook.presto.testing.LocalQueryRunner;\n+import com.facebook.presto.tpcds.TpcdsConnectorFactory;\n+import com.google.common.collect.ImmutableMap;\n+\n+import java.nio.file.Path;\n+import java.nio.file.Paths;\n+import java.util.stream.IntStream;\n+import java.util.stream.Stream;\n+\n+import static com.facebook.presto.SystemSessionProperties.JOIN_DISTRIBUTION_TYPE;\n+import static com.facebook.presto.SystemSessionProperties.JOIN_REORDERING_STRATEGY;\n+import static com.facebook.presto.testing.TestingSession.testSessionBuilder;\n+import static java.lang.String.format;\n+\n+/**\n+ * This class tests cost-based optimization rules related to joins. It contains unmodified TPCDS queries.\n+ * This class is using TPCDS connector configured in way to mock Hive connector with unpartitioned TPCDS tables.\n+ */\n+public class TestTpcdsCostBasedPlan\n+        extends BaseCostBasedPlanTest\n+{\n+    /*\n+     * CAUTION: The expected plans here are not necessarily optimal yet. Their role is to prevent\n+     * inadvertent regressions. A conscious improvement to the planner may require changing some\n+     * of the expected plans, but any such change should be verified on an actual cluster with\n+     * large amount of data.\n+     */\n+\n+    public TestTpcdsCostBasedPlan()\n+    {\n+        super(() -> {\n+            String catalog = \"local\";\n+            Session.SessionBuilder sessionBuilder = testSessionBuilder()\n+                    .setCatalog(catalog)\n+                    .setSchema(\"sf3000.0\")\n+                    .setSystemProperty(\"task_concurrency\", \"1\") // these tests don't handle exchanges from local parallel\n+                    .setSystemProperty(JOIN_REORDERING_STRATEGY, JoinReorderingStrategy.AUTOMATIC.name())\n+                    .setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.AUTOMATIC.name());\n+\n+            LocalQueryRunner queryRunner = LocalQueryRunner.queryRunnerWithFakeNodeCountForStats(sessionBuilder.build(), 8);\n+            queryRunner.createCatalog(\n+                    catalog,\n+                    new TpcdsConnectorFactory(1),\n+                    ImmutableMap.of());\n+            return queryRunner;\n+        });\n+    }\n+\n+    @Override\n+    protected Stream<Query> getQueries()\n+    {\n+        return IntStream.range(1, 100)\n+                .boxed()\n+                .flatMap(i -> {\n+                    String queryId = format(\"q%02d\", i);\n+                    if (i == 14 || i == 23 || i == 24 || i == 39) {","path":"presto-tpcds/src/test/java/com/facebook/presto/sql/planner/optimizations/TestTpcdsCostBasedPlan.java","position":75,"original_position":75,"commit_id":"6653f685c41b9f48e4e5066e4e58758fe4b2de5d","original_commit_id":"6653f685c41b9f48e4e5066e4e58758fe4b2de5d","user":{"login":"arhimondr","id":5570988,"node_id":"MDQ6VXNlcjU1NzA5ODg=","avatar_url":"https://avatars3.githubusercontent.com/u/5570988?v=4","gravatar_id":"","url":"https://api.github.com/users/arhimondr","html_url":"https://github.com/arhimondr","followers_url":"https://api.github.com/users/arhimondr/followers","following_url":"https://api.github.com/users/arhimondr/following{/other_user}","gists_url":"https://api.github.com/users/arhimondr/gists{/gist_id}","starred_url":"https://api.github.com/users/arhimondr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arhimondr/subscriptions","organizations_url":"https://api.github.com/users/arhimondr/orgs","repos_url":"https://api.github.com/users/arhimondr/repos","events_url":"https://api.github.com/users/arhimondr/events{/privacy}","received_events_url":"https://api.github.com/users/arhimondr/received_events","type":"User","site_admin":false},"body":"This looks like something very ugly","created_at":"2018-08-31T00:51:31Z","updated_at":"2018-08-31T00:55:27Z","html_url":"https://github.com/prestodb/presto/pull/11267#discussion_r214220566","pull_request_url":"https://api.github.com/repos/prestodb/presto/pulls/11267","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments/214220566"},"html":{"href":"https://github.com/prestodb/presto/pull/11267#discussion_r214220566"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11267"}}},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/11267","id":208192137,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4MTkyMTM3","html_url":"https://github.com/prestodb/presto/pull/11267","diff_url":"https://github.com/prestodb/presto/pull/11267.diff","patch_url":"https://github.com/prestodb/presto/pull/11267.patch","issue_url":"https://api.github.com/repos/prestodb/presto/issues/11267","number":11267,"state":"open","locked":false,"title":"Test cost-based decisions on TPCH, TPCDS queries and CBO improvements","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-08-14T07:30:53Z","updated_at":"2018-08-31T00:55:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"608149a0c61bd26bb0bd7f5126f4ef3e4e6451a0","assignee":null,"assignees":[],"requested_reviewers":[],"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/11267/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto/pulls/11267/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/11267/comments","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/6653f685c41b9f48e4e5066e4e58758fe4b2de5d","head":{"label":"starburstdata:epic/cbo/pr/42","ref":"epic/cbo/pr/42","sha":"6653f685c41b9f48e4e5066e4e58758fe4b2de5d","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-08-30T20:57:32Z","pushed_at":"2018-08-30T21:51:15Z","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":101931,"stargazers_count":29,"watchers_count":29,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":1,"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":3,"open_issues":1,"watchers":29,"default_branch":"master"}},"base":{"label":"prestodb:master","ref":"master","sha":"de6e5141be3766523b0ff057c4b83d424e4dfbbc","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-08-31T00:33:24Z","pushed_at":"2018-08-31T00:18:52Z","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":97306,"stargazers_count":7986,"watchers_count":7986,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2701,"mirror_url":null,"archived":false,"open_issues_count":1377,"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":2701,"open_issues":1377,"watchers":7986,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11267"},"html":{"href":"https://github.com/prestodb/presto/pull/11267"},"issue":{"href":"https://api.github.com/repos/prestodb/presto/issues/11267"},"comments":{"href":"https://api.github.com/repos/prestodb/presto/issues/11267/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11267/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11267/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto/statuses/6653f685c41b9f48e4e5066e4e58758fe4b2de5d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"arhimondr"}}