{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto/pulls/comments/223247099","pull_request_review_id":162327178,"id":223247099,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzI0NzA5OQ==","diff_hunk":"@@ -185,17 +176,32 @@ protected PlanNodeStatsEstimate visitLogicalBinaryExpression(LogicalBinaryExpres\n \n         private PlanNodeStatsEstimate estimateLogicalAnd(Expression left, Expression right)\n         {\n+            // first try to estimate in the fair way\n             PlanNodeStatsEstimate leftEstimate = process(left);\n             if (!leftEstimate.isOutputRowCountUnknown()) {\n                 PlanNodeStatsEstimate logicalAndEstimate = new FilterExpressionStatsCalculatingVisitor(leftEstimate, session, types).process(right);\n                 if (!logicalAndEstimate.isOutputRowCountUnknown()) {\n                     return logicalAndEstimate;\n                 }\n-                return filterStatsForUnknownExpression(leftEstimate);\n             }\n \n+            // If some of the filters cannot be estimated, take the smallest estimate.\n+            // Apply 0.9 filter factor as \"unknown filter\" factor.\n             PlanNodeStatsEstimate rightEstimate = process(right);\n-            return filterStatsForUnknownExpression(rightEstimate);\n+            PlanNodeStatsEstimate smallestKnownEstimate;\n+            if (leftEstimate.isOutputRowCountUnknown()) {\n+                smallestKnownEstimate = rightEstimate;\n+            }\n+            else if (rightEstimate.isOutputRowCountUnknown()) {\n+                smallestKnownEstimate = leftEstimate;\n+            }\n+            else {\n+                smallestKnownEstimate = leftEstimate.getOutputRowCount() <= rightEstimate.getOutputRowCount() ? leftEstimate : rightEstimate;","path":"presto-main/src/main/java/com/facebook/presto/cost/FilterStatsCalculator.java","position":147,"original_position":52,"commit_id":"2aa1d30a751d294713439b506107563fa6bb4e26","original_commit_id":"0f97d4f471e9b8e0cbe331d39a974a98ae4b23ad","user":{"login":"kokosing","id":7569403,"node_id":"MDQ6VXNlcjc1Njk0MDM=","avatar_url":"https://avatars2.githubusercontent.com/u/7569403?v=4","gravatar_id":"","url":"https://api.github.com/users/kokosing","html_url":"https://github.com/kokosing","followers_url":"https://api.github.com/users/kokosing/followers","following_url":"https://api.github.com/users/kokosing/following{/other_user}","gists_url":"https://api.github.com/users/kokosing/gists{/gist_id}","starred_url":"https://api.github.com/users/kokosing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kokosing/subscriptions","organizations_url":"https://api.github.com/users/kokosing/orgs","repos_url":"https://api.github.com/users/kokosing/repos","events_url":"https://api.github.com/users/kokosing/events{/privacy}","received_events_url":"https://api.github.com/users/kokosing/received_events","type":"User","site_admin":false},"body":"nvm","created_at":"2018-10-08T04:37:20Z","updated_at":"2018-10-08T04:37:20Z","html_url":"https://github.com/prestodb/presto/pull/11625#discussion_r223247099","pull_request_url":"https://api.github.com/repos/prestodb/presto/pulls/11625","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments/223247099"},"html":{"href":"https://github.com/prestodb/presto/pull/11625#discussion_r223247099"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11625"}},"in_reply_to_id":222950914},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/11625","id":219786468,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5Nzg2NDY4","html_url":"https://github.com/prestodb/presto/pull/11625","diff_url":"https://github.com/prestodb/presto/pull/11625.diff","patch_url":"https://github.com/prestodb/presto/pull/11625.patch","issue_url":"https://api.github.com/repos/prestodb/presto/issues/11625","number":11625,"state":"open","locked":false,"title":"[WIP] Avoid making wild guesses in FILTER and JOIN estimates","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":"Apply 0.9 coefficient for a conjunct that cannot be estimated only if at least a single conjunct was estimated.","created_at":"2018-10-02T17:36:30Z","updated_at":"2018-10-08T04:37:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"85ba7c5d34073f44d83c5d876f79a2559a3b2834","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/11625/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto/pulls/11625/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/11625/comments","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/2aa1d30a751d294713439b506107563fa6bb4e26","head":{"label":"arhimondr:avoid-wild-guesses-in-estimates","ref":"avoid-wild-guesses-in-estimates","sha":"2aa1d30a751d294713439b506107563fa6bb4e26","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},"repo":{"id":37681604,"node_id":"MDEwOlJlcG9zaXRvcnkzNzY4MTYwNA==","name":"presto","full_name":"arhimondr/presto","private":false,"owner":{"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},"html_url":"https://github.com/arhimondr/presto","description":"Distributed SQL query engine for running interactive analytic queries against big data sources.","fork":true,"url":"https://api.github.com/repos/arhimondr/presto","forks_url":"https://api.github.com/repos/arhimondr/presto/forks","keys_url":"https://api.github.com/repos/arhimondr/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arhimondr/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arhimondr/presto/teams","hooks_url":"https://api.github.com/repos/arhimondr/presto/hooks","issue_events_url":"https://api.github.com/repos/arhimondr/presto/issues/events{/number}","events_url":"https://api.github.com/repos/arhimondr/presto/events","assignees_url":"https://api.github.com/repos/arhimondr/presto/assignees{/user}","branches_url":"https://api.github.com/repos/arhimondr/presto/branches{/branch}","tags_url":"https://api.github.com/repos/arhimondr/presto/tags","blobs_url":"https://api.github.com/repos/arhimondr/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arhimondr/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arhimondr/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/arhimondr/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arhimondr/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/arhimondr/presto/languages","stargazers_url":"https://api.github.com/repos/arhimondr/presto/stargazers","contributors_url":"https://api.github.com/repos/arhimondr/presto/contributors","subscribers_url":"https://api.github.com/repos/arhimondr/presto/subscribers","subscription_url":"https://api.github.com/repos/arhimondr/presto/subscription","commits_url":"https://api.github.com/repos/arhimondr/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/arhimondr/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/arhimondr/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/arhimondr/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/arhimondr/presto/contents/{+path}","compare_url":"https://api.github.com/repos/arhimondr/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arhimondr/presto/merges","archive_url":"https://api.github.com/repos/arhimondr/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arhimondr/presto/downloads","issues_url":"https://api.github.com/repos/arhimondr/presto/issues{/number}","pulls_url":"https://api.github.com/repos/arhimondr/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/arhimondr/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/arhimondr/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arhimondr/presto/labels{/name}","releases_url":"https://api.github.com/repos/arhimondr/presto/releases{/id}","deployments_url":"https://api.github.com/repos/arhimondr/presto/deployments","created_at":"2015-06-18T19:57:44Z","updated_at":"2018-09-12T17:25:00Z","pushed_at":"2018-10-05T16:16:27Z","git_url":"git://github.com/arhimondr/presto.git","ssh_url":"git@github.com:arhimondr/presto.git","clone_url":"https://github.com/arhimondr/presto.git","svn_url":"https://github.com/arhimondr/presto","homepage":"https://prestodb.io","size":98168,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"prestodb:master","ref":"master","sha":"6da0262762d438ef781a6da3956fdb7fa8f1d5b2","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","private":false,"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},"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-10-07T12:01:26Z","pushed_at":"2018-10-08T03:58:19Z","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":98792,"stargazers_count":8155,"watchers_count":8155,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2765,"mirror_url":null,"archived":false,"open_issues_count":1415,"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":2765,"open_issues":1415,"watchers":8155,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11625"},"html":{"href":"https://github.com/prestodb/presto/pull/11625"},"issue":{"href":"https://api.github.com/repos/prestodb/presto/issues/11625"},"comments":{"href":"https://api.github.com/repos/prestodb/presto/issues/11625/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11625/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto/pulls/11625/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto/statuses/2aa1d30a751d294713439b506107563fa6bb4e26"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"kokosing"}}