GitHub PullRequestReviewCommentEvent at 2014-12-12 16:37:40
Repository: voltdb
Actor: jxchinaren
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/21755508","id":21755508,"diff_hunk":"@@ -456,43 +474,72 @@ private void placeTVEsinColumns () {\n             m_projectSchema.addColumn(schema_col);\n         }\n \n-        // Replace TVE for order by columns\n-        for (ParsedColInfo orderCol : m_orderColumns) {\n-            AbstractExpression expr = orderCol.expression.replaceWithTVE(aggTableIndexMap, indexToColumnMap);\n+        if (hasDistinctWithGroupBy() && m_distinctGroupByColumns != null) {\n+            assert(hasComplexAgg() || displayColumnsContainAllGroupByColumns());\n+            // DISTINCT group by expressions are already TVEs when set\n+        }\n \n-            if (hasComplexAgg()) {\n-                orderCol.expression = expr;\n-            } else {\n-                // This if case checking is to rule out cases like: select PKEY + A_INT from O1 order by PKEY + A_INT,\n-                // This case later needs a projection node on top of sort node to make it work.\n+        placeTVEsForOrderby(aggTableIndexMap, indexToColumnMap);\n+    }\n+\n+    /**\n+     * Replace TVE for order by columns.\n+     * Restrictions: Order by clause must operate on display column list, except for columns that are\n+     * (1) GROUP BY columns list without DISTINCT,\n+     * (2) in tables or joined tables without GROUP BY or DISTINCT clause.\n+     *\n+     * Display columns means exact columns/expressions in the select list or tag alias.\n+     * Order by clause can be columns or expressions on the columns.\n+     */\n+    private void placeTVEsForOrderby(Map <AbstractExpression, Integer> aggTableIndexMap,\n+            Map <Integer, ParsedColInfo> indexToColumnMap) {\n+        // Detect the edge order by case\n+        detectComplexOrderby();\n \n-                // Assuming the restrictions: Order by columns are (1) columns from table\n-                // (2) tag from display columns (3) actual expressions from display columns\n-                // Currently, we do not allow order by complex expressions that are not in display columns\n+        if (isComplexOrderby()) {\n+            // Case that ORDER BY is below Projection node\n+            for (ParsedColInfo orderCol : m_orderColumns) {","path":"src/frontend/org/voltdb/planner/ParsedSelectStmt.java","position":97,"original_position":97,"commit_id":"91cee8720d24d079b2470f2918bab420ae8abcd6","original_commit_id":"91cee8720d24d079b2470f2918bab420ae8abcd6","user":{"login":"jxchinaren","id":1305380,"avatar_url":"https://avatars.githubusercontent.com/u/1305380?v=3","gravatar_id":"","url":"https://api.github.com/users/jxchinaren","html_url":"https://github.com/jxchinaren","followers_url":"https://api.github.com/users/jxchinaren/followers","following_url":"https://api.github.com/users/jxchinaren/following{/other_user}","gists_url":"https://api.github.com/users/jxchinaren/gists{/gist_id}","starred_url":"https://api.github.com/users/jxchinaren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jxchinaren/subscriptions","organizations_url":"https://api.github.com/users/jxchinaren/orgs","repos_url":"https://api.github.com/users/jxchinaren/repos","events_url":"https://api.github.com/users/jxchinaren/events{/privacy}","received_events_url":"https://api.github.com/users/jxchinaren/received_events","type":"User","site_admin":false},"body":"Yes, replaceWithTVE will create a new expression and will not change itself. I like the second option. ","created_at":"2014-12-12T16:37:40Z","updated_at":"2014-12-12T16:37:40Z","html_url":"https://github.com/VoltDB/voltdb/pull/1891#discussion_r21755508","pull_request_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891","_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/21755508"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/1891#discussion_r21755508"},"pull_request":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891"}}},"pull_request":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891","id":25835348,"html_url":"https://github.com/VoltDB/voltdb/pull/1891","diff_url":"https://github.com/VoltDB/voltdb/pull/1891.diff","patch_url":"https://github.com/VoltDB/voltdb/pull/1891.patch","issue_url":"https://api.github.com/repos/VoltDB/voltdb/issues/1891","number":1891,"state":"open","locked":false,"title":"Eng 7326 plannode reorder","user":{"login":"jxchinaren","id":1305380,"avatar_url":"https://avatars.githubusercontent.com/u/1305380?v=3","gravatar_id":"","url":"https://api.github.com/users/jxchinaren","html_url":"https://github.com/jxchinaren","followers_url":"https://api.github.com/users/jxchinaren/followers","following_url":"https://api.github.com/users/jxchinaren/following{/other_user}","gists_url":"https://api.github.com/users/jxchinaren/gists{/gist_id}","starred_url":"https://api.github.com/users/jxchinaren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jxchinaren/subscriptions","organizations_url":"https://api.github.com/users/jxchinaren/orgs","repos_url":"https://api.github.com/users/jxchinaren/repos","events_url":"https://api.github.com/users/jxchinaren/events{/privacy}","received_events_url":"https://api.github.com/users/jxchinaren/received_events","type":"User","site_admin":false},"body":"This pull requests is basically reordering the Projection node and ORDER BY node for step 1. Step 2 will make the Aggregation node and Projection node inline for certain cases.\r\n\r\nFor some cases we can not reorder the plan node tree for ORDER BY, I regressed it to use the old plans although they are not efficient.","created_at":"2014-12-10T16:35:52Z","updated_at":"2014-12-12T16:37:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7623aaf317d52159364e4ebc42b0059fd26dc7ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891/commits","review_comments_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891/comments","review_comment_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/{number}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/issues/1891/comments","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/91cee8720d24d079b2470f2918bab420ae8abcd6","head":{"label":"VoltDB:ENG-7326-plannode-reorder","ref":"ENG-7326-plannode-reorder","sha":"91cee8720d24d079b2470f2918bab420ae8abcd6","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments/{number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2014-12-12T15:12:20Z","pushed_at":"2014-12-12T15:12:23Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":557509,"stargazers_count":408,"watchers_count":408,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":120,"mirror_url":null,"open_issues_count":21,"forks":120,"open_issues":21,"watchers":408,"default_branch":"master"}},"base":{"label":"VoltDB:master","ref":"master","sha":"e1691ccd46c6a6643129e5a2a4505293df876186","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments/{number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2014-12-12T15:12:20Z","pushed_at":"2014-12-12T15:12:23Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":557509,"stargazers_count":408,"watchers_count":408,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":120,"mirror_url":null,"open_issues_count":21,"forks":120,"open_issues":21,"watchers":408,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/1891"},"issue":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/1891"},"comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/1891/comments"},"review_comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891/comments"},"review_comment":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1891/commits"},"statuses":{"href":"https://api.github.com/repos/VoltDB/voltdb/statuses/91cee8720d24d079b2470f2918bab420ae8abcd6"}}}}