{"action":"created","comment":{"url":"https://api.github.com/repos/greenplum-db/gporca/pulls/comments/235856384","pull_request_review_id":177819985,"id":235856384,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTg1NjM4NA==","diff_hunk":"@@ -39,7 +39,18 @@ CPhysicalHashAggDeduplicate::CPhysicalHashAggDeduplicate\n \tBOOL fMultiStage\n \t)\n \t:\n-\tCPhysicalHashAgg(mp, colref_array, pdrgpcrMinimal, egbaggtype, fGeneratesDuplicates, NULL /*pdrgpcrGbMinusDistinct*/, fMultiStage),\n+\tCPhysicalHashAgg\n+\t\t(\n+\t\t mp,\n+\t\t colref_array,\n+\t\t pdrgpcrMinimal,\n+\t\t egbaggtype,\n+\t\t fGeneratesDuplicates,\n+\t\t NULL /*pdrgpcrGbMinusDistinct*/,\n+\t\t fMultiStage,\n+\t\t false /* m_isAggFromSplitDQA */,\n+\t\t false /* m_isAggThreeStage */","path":"libgpopt/src/operators/CPhysicalHashAggDeduplicate.cpp","position":15,"original_position":15,"commit_id":"bae02fe7306586bd156a37c59568ab89d02109e3","original_commit_id":"bae02fe7306586bd156a37c59568ab89d02109e3","user":{"login":"vraghavan78","id":12649877,"node_id":"MDQ6VXNlcjEyNjQ5ODc3","avatar_url":"https://avatars1.githubusercontent.com/u/12649877?v=4","gravatar_id":"","url":"https://api.github.com/users/vraghavan78","html_url":"https://github.com/vraghavan78","followers_url":"https://api.github.com/users/vraghavan78/followers","following_url":"https://api.github.com/users/vraghavan78/following{/other_user}","gists_url":"https://api.github.com/users/vraghavan78/gists{/gist_id}","starred_url":"https://api.github.com/users/vraghavan78/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vraghavan78/subscriptions","organizations_url":"https://api.github.com/users/vraghavan78/orgs","repos_url":"https://api.github.com/users/vraghavan78/repos","events_url":"https://api.github.com/users/vraghavan78/events{/privacy}","received_events_url":"https://api.github.com/users/vraghavan78/received_events","type":"User","site_admin":false},"body":"why this is initialisation? Shouldn't the logical operator provide u this?","created_at":"2018-11-23T07:00:37Z","updated_at":"2018-11-23T07:00:37Z","html_url":"https://github.com/greenplum-db/gporca/pull/426#discussion_r235856384","pull_request_url":"https://api.github.com/repos/greenplum-db/gporca/pulls/426","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/greenplum-db/gporca/pulls/comments/235856384"},"html":{"href":"https://github.com/greenplum-db/gporca/pull/426#discussion_r235856384"},"pull_request":{"href":"https://api.github.com/repos/greenplum-db/gporca/pulls/426"}}},"pull_request":{"url":"https://api.github.com/repos/greenplum-db/gporca/pulls/426","id":232818686,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyODE4Njg2","html_url":"https://github.com/greenplum-db/gporca/pull/426","diff_url":"https://github.com/greenplum-db/gporca/pull/426.diff","patch_url":"https://github.com/greenplum-db/gporca/pull/426.patch","issue_url":"https://api.github.com/repos/greenplum-db/gporca/issues/426","number":426,"state":"open","locked":false,"title":"Make CXformSplitDQA always generate a two-stage agg","user":{"login":"sambitesh","id":8096768,"node_id":"MDQ6VXNlcjgwOTY3Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/8096768?v=4","gravatar_id":"","url":"https://api.github.com/users/sambitesh","html_url":"https://github.com/sambitesh","followers_url":"https://api.github.com/users/sambitesh/followers","following_url":"https://api.github.com/users/sambitesh/following{/other_user}","gists_url":"https://api.github.com/users/sambitesh/gists{/gist_id}","starred_url":"https://api.github.com/users/sambitesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sambitesh/subscriptions","organizations_url":"https://api.github.com/users/sambitesh/orgs","repos_url":"https://api.github.com/users/sambitesh/repos","events_url":"https://api.github.com/users/sambitesh/events{/privacy}","received_events_url":"https://api.github.com/users/sambitesh/received_events","type":"User","site_admin":false},"body":"When optimizer_force_three_stage_scalar_dqa is on. We expect the below:\r\n\r\n- We expect ORCA to pick up three stage DQA.\r\n- If three stage DQA is not picked because it couldn't be optimized, then pick\r\n  at least two stage DQA.  because in case of 2 Stage Agg, one of the agg will\r\n  be on segment and other will be on master after the gather in case of select\r\n  queries.\r\n\r\nConsider the case below:\r\n```\r\ncreate table foo (a int);\r\nexplain select count(distinct a) from foo;\r\n```\r\nPreviously, this would give us a one stage agg because a three stage couldn't\r\nbe optimized and no 2-stage option was generated by CXformSplitDQA.  But now,\r\nwe make sure to generate both 2-stage aggs and 3-stage aggs in CXformSplitDQA.\r\n\r\nFor `explain select count(distinct a) from foo;`\r\n\r\nEarlier Plan\r\n```\r\n\t\t\tQUERY PLAN\r\n----------------------------------------------------------------------------------------\r\n Aggregate  (cost=0.00..433.48 rows=1 width=8)\r\n   ->  Gather Motion 3:1  (slice1; segments: 3)  (cost=0.00..433.43 rows=99984 width=4)\r\n         ->  Table Scan on foo  (cost=0.00..431.70 rows=33328 width=4)\r\n```\r\n\r\nPresent plan\r\n```\r\n\t\t\tQUERY PLAN\r\n------------------------------------------------------------------------------------\r\n Aggregate  (cost=0.00..431.96 rows=1 width=8)\r\n   ->  Gather Motion 3:1  (slice1; segments: 3)  (cost=0.00..431.96 rows=1 width=8)\r\n         ->  Aggregate  (cost=0.00..431.96 rows=1 width=8)\r\n               ->  Table Scan on foo  (cost=0.00..431.70 rows=33331 width=4)\r\n```\r\nWe also had to make sure that, when optimizer_force_three_stage_scalar_dqa is\r\non, pick 3-stage aggs.\r\nFor this we first tracked the 2-stage aggs and 3-stage aggs created by CXformSplitDQA.\r\nIn CConstContext::FbetterThan, we made sure 3-stage aggs from CXformSplitDQA\r\nare marked as more optimal than 2-stage aggs from CXformSplitDQA.","created_at":"2018-11-21T23:00:44Z","updated_at":"2018-11-23T07:00:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31b415297f900c1ff20b19f9510c07d090203a42","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/greenplum-db/gporca/pulls/426/commits","review_comments_url":"https://api.github.com/repos/greenplum-db/gporca/pulls/426/comments","review_comment_url":"https://api.github.com/repos/greenplum-db/gporca/pulls/comments{/number}","comments_url":"https://api.github.com/repos/greenplum-db/gporca/issues/426/comments","statuses_url":"https://api.github.com/repos/greenplum-db/gporca/statuses/bae02fe7306586bd156a37c59568ab89d02109e3","head":{"label":"sambitesh:dqa2","ref":"dqa2","sha":"bae02fe7306586bd156a37c59568ab89d02109e3","user":{"login":"sambitesh","id":8096768,"node_id":"MDQ6VXNlcjgwOTY3Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/8096768?v=4","gravatar_id":"","url":"https://api.github.com/users/sambitesh","html_url":"https://github.com/sambitesh","followers_url":"https://api.github.com/users/sambitesh/followers","following_url":"https://api.github.com/users/sambitesh/following{/other_user}","gists_url":"https://api.github.com/users/sambitesh/gists{/gist_id}","starred_url":"https://api.github.com/users/sambitesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sambitesh/subscriptions","organizations_url":"https://api.github.com/users/sambitesh/orgs","repos_url":"https://api.github.com/users/sambitesh/repos","events_url":"https://api.github.com/users/sambitesh/events{/privacy}","received_events_url":"https://api.github.com/users/sambitesh/received_events","type":"User","site_admin":false},"repo":{"id":111033445,"node_id":"MDEwOlJlcG9zaXRvcnkxMTEwMzM0NDU=","name":"gporca","full_name":"sambitesh/gporca","private":false,"owner":{"login":"sambitesh","id":8096768,"node_id":"MDQ6VXNlcjgwOTY3Njg=","avatar_url":"https://avatars0.githubusercontent.com/u/8096768?v=4","gravatar_id":"","url":"https://api.github.com/users/sambitesh","html_url":"https://github.com/sambitesh","followers_url":"https://api.github.com/users/sambitesh/followers","following_url":"https://api.github.com/users/sambitesh/following{/other_user}","gists_url":"https://api.github.com/users/sambitesh/gists{/gist_id}","starred_url":"https://api.github.com/users/sambitesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sambitesh/subscriptions","organizations_url":"https://api.github.com/users/sambitesh/orgs","repos_url":"https://api.github.com/users/sambitesh/repos","events_url":"https://api.github.com/users/sambitesh/events{/privacy}","received_events_url":"https://api.github.com/users/sambitesh/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sambitesh/gporca","description":"A modular query optimizer for big data","fork":true,"url":"https://api.github.com/repos/sambitesh/gporca","forks_url":"https://api.github.com/repos/sambitesh/gporca/forks","keys_url":"https://api.github.com/repos/sambitesh/gporca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sambitesh/gporca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sambitesh/gporca/teams","hooks_url":"https://api.github.com/repos/sambitesh/gporca/hooks","issue_events_url":"https://api.github.com/repos/sambitesh/gporca/issues/events{/number}","events_url":"https://api.github.com/repos/sambitesh/gporca/events","assignees_url":"https://api.github.com/repos/sambitesh/gporca/assignees{/user}","branches_url":"https://api.github.com/repos/sambitesh/gporca/branches{/branch}","tags_url":"https://api.github.com/repos/sambitesh/gporca/tags","blobs_url":"https://api.github.com/repos/sambitesh/gporca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sambitesh/gporca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sambitesh/gporca/git/refs{/sha}","trees_url":"https://api.github.com/repos/sambitesh/gporca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sambitesh/gporca/statuses/{sha}","languages_url":"https://api.github.com/repos/sambitesh/gporca/languages","stargazers_url":"https://api.github.com/repos/sambitesh/gporca/stargazers","contributors_url":"https://api.github.com/repos/sambitesh/gporca/contributors","subscribers_url":"https://api.github.com/repos/sambitesh/gporca/subscribers","subscription_url":"https://api.github.com/repos/sambitesh/gporca/subscription","commits_url":"https://api.github.com/repos/sambitesh/gporca/commits{/sha}","git_commits_url":"https://api.github.com/repos/sambitesh/gporca/git/commits{/sha}","comments_url":"https://api.github.com/repos/sambitesh/gporca/comments{/number}","issue_comment_url":"https://api.github.com/repos/sambitesh/gporca/issues/comments{/number}","contents_url":"https://api.github.com/repos/sambitesh/gporca/contents/{+path}","compare_url":"https://api.github.com/repos/sambitesh/gporca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sambitesh/gporca/merges","archive_url":"https://api.github.com/repos/sambitesh/gporca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sambitesh/gporca/downloads","issues_url":"https://api.github.com/repos/sambitesh/gporca/issues{/number}","pulls_url":"https://api.github.com/repos/sambitesh/gporca/pulls{/number}","milestones_url":"https://api.github.com/repos/sambitesh/gporca/milestones{/number}","notifications_url":"https://api.github.com/repos/sambitesh/gporca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sambitesh/gporca/labels{/name}","releases_url":"https://api.github.com/repos/sambitesh/gporca/releases{/id}","deployments_url":"https://api.github.com/repos/sambitesh/gporca/deployments","created_at":"2017-11-16T23:22:27Z","updated_at":"2017-11-16T23:22:44Z","pushed_at":"2018-11-21T22:59:10Z","git_url":"git://github.com/sambitesh/gporca.git","ssh_url":"git@github.com:sambitesh/gporca.git","clone_url":"https://github.com/sambitesh/gporca.git","svn_url":"https://github.com/sambitesh/gporca","homepage":"","size":45009,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"greenplum-db:master","ref":"master","sha":"6e567f29621a651e266eb3593ed26e7d782a6e66","user":{"login":"greenplum-db","id":14097842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MDk3ODQy","avatar_url":"https://avatars2.githubusercontent.com/u/14097842?v=4","gravatar_id":"","url":"https://api.github.com/users/greenplum-db","html_url":"https://github.com/greenplum-db","followers_url":"https://api.github.com/users/greenplum-db/followers","following_url":"https://api.github.com/users/greenplum-db/following{/other_user}","gists_url":"https://api.github.com/users/greenplum-db/gists{/gist_id}","starred_url":"https://api.github.com/users/greenplum-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenplum-db/subscriptions","organizations_url":"https://api.github.com/users/greenplum-db/orgs","repos_url":"https://api.github.com/users/greenplum-db/repos","events_url":"https://api.github.com/users/greenplum-db/events{/privacy}","received_events_url":"https://api.github.com/users/greenplum-db/received_events","type":"Organization","site_admin":false},"repo":{"id":47849203,"node_id":"MDEwOlJlcG9zaXRvcnk0Nzg0OTIwMw==","name":"gporca","full_name":"greenplum-db/gporca","private":false,"owner":{"login":"greenplum-db","id":14097842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MDk3ODQy","avatar_url":"https://avatars2.githubusercontent.com/u/14097842?v=4","gravatar_id":"","url":"https://api.github.com/users/greenplum-db","html_url":"https://github.com/greenplum-db","followers_url":"https://api.github.com/users/greenplum-db/followers","following_url":"https://api.github.com/users/greenplum-db/following{/other_user}","gists_url":"https://api.github.com/users/greenplum-db/gists{/gist_id}","starred_url":"https://api.github.com/users/greenplum-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greenplum-db/subscriptions","organizations_url":"https://api.github.com/users/greenplum-db/orgs","repos_url":"https://api.github.com/users/greenplum-db/repos","events_url":"https://api.github.com/users/greenplum-db/events{/privacy}","received_events_url":"https://api.github.com/users/greenplum-db/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/greenplum-db/gporca","description":"A modular query optimizer for big data","fork":false,"url":"https://api.github.com/repos/greenplum-db/gporca","forks_url":"https://api.github.com/repos/greenplum-db/gporca/forks","keys_url":"https://api.github.com/repos/greenplum-db/gporca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/greenplum-db/gporca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/greenplum-db/gporca/teams","hooks_url":"https://api.github.com/repos/greenplum-db/gporca/hooks","issue_events_url":"https://api.github.com/repos/greenplum-db/gporca/issues/events{/number}","events_url":"https://api.github.com/repos/greenplum-db/gporca/events","assignees_url":"https://api.github.com/repos/greenplum-db/gporca/assignees{/user}","branches_url":"https://api.github.com/repos/greenplum-db/gporca/branches{/branch}","tags_url":"https://api.github.com/repos/greenplum-db/gporca/tags","blobs_url":"https://api.github.com/repos/greenplum-db/gporca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/greenplum-db/gporca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/greenplum-db/gporca/git/refs{/sha}","trees_url":"https://api.github.com/repos/greenplum-db/gporca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/greenplum-db/gporca/statuses/{sha}","languages_url":"https://api.github.com/repos/greenplum-db/gporca/languages","stargazers_url":"https://api.github.com/repos/greenplum-db/gporca/stargazers","contributors_url":"https://api.github.com/repos/greenplum-db/gporca/contributors","subscribers_url":"https://api.github.com/repos/greenplum-db/gporca/subscribers","subscription_url":"https://api.github.com/repos/greenplum-db/gporca/subscription","commits_url":"https://api.github.com/repos/greenplum-db/gporca/commits{/sha}","git_commits_url":"https://api.github.com/repos/greenplum-db/gporca/git/commits{/sha}","comments_url":"https://api.github.com/repos/greenplum-db/gporca/comments{/number}","issue_comment_url":"https://api.github.com/repos/greenplum-db/gporca/issues/comments{/number}","contents_url":"https://api.github.com/repos/greenplum-db/gporca/contents/{+path}","compare_url":"https://api.github.com/repos/greenplum-db/gporca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/greenplum-db/gporca/merges","archive_url":"https://api.github.com/repos/greenplum-db/gporca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/greenplum-db/gporca/downloads","issues_url":"https://api.github.com/repos/greenplum-db/gporca/issues{/number}","pulls_url":"https://api.github.com/repos/greenplum-db/gporca/pulls{/number}","milestones_url":"https://api.github.com/repos/greenplum-db/gporca/milestones{/number}","notifications_url":"https://api.github.com/repos/greenplum-db/gporca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/greenplum-db/gporca/labels{/name}","releases_url":"https://api.github.com/repos/greenplum-db/gporca/releases{/id}","deployments_url":"https://api.github.com/repos/greenplum-db/gporca/deployments","created_at":"2015-12-11T20:24:47Z","updated_at":"2018-11-18T14:17:44Z","pushed_at":"2018-11-21T23:37:38Z","git_url":"git://github.com/greenplum-db/gporca.git","ssh_url":"git@github.com:greenplum-db/gporca.git","clone_url":"https://github.com/greenplum-db/gporca.git","svn_url":"https://github.com/greenplum-db/gporca","homepage":"","size":44096,"stargazers_count":163,"watchers_count":163,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":92,"mirror_url":null,"archived":false,"open_issues_count":27,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":92,"open_issues":27,"watchers":163,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/greenplum-db/gporca/pulls/426"},"html":{"href":"https://github.com/greenplum-db/gporca/pull/426"},"issue":{"href":"https://api.github.com/repos/greenplum-db/gporca/issues/426"},"comments":{"href":"https://api.github.com/repos/greenplum-db/gporca/issues/426/comments"},"review_comments":{"href":"https://api.github.com/repos/greenplum-db/gporca/pulls/426/comments"},"review_comment":{"href":"https://api.github.com/repos/greenplum-db/gporca/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/greenplum-db/gporca/pulls/426/commits"},"statuses":{"href":"https://api.github.com/repos/greenplum-db/gporca/statuses/bae02fe7306586bd156a37c59568ab89d02109e3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"vraghavan78"}}