{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto/pulls/comments/187865983","pull_request_review_id":119728978,"id":187865983,"diff_hunk":"@@ -0,0 +1,112 @@\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+package com.facebook.presto.hive.util;\n+\n+import com.facebook.presto.spi.Page;\n+import com.facebook.presto.spi.PageSorter;\n+import com.facebook.presto.spi.block.SortOrder;\n+import com.facebook.presto.spi.type.Type;\n+import com.google.common.collect.ImmutableList;\n+import io.airlift.units.DataSize;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import static com.google.common.base.Preconditions.checkArgument;\n+import static com.google.common.base.Preconditions.checkState;\n+import static com.google.common.base.Verify.verify;\n+import static java.lang.Math.addExact;\n+import static java.util.Objects.requireNonNull;\n+\n+public class SortBuffer\n+{\n+    private final long maxMemoryBytes;\n+    private final List<Type> types;\n+    private final List<Integer> sortFields;\n+    private final List<SortOrder> sortOrders;\n+    private final PageSorter pageSorter;","path":"presto-hive/src/main/java/com/facebook/presto/hive/util/SortBuffer.java","position":38,"original_position":38,"commit_id":"1c7be9d9ba1218cd7436feab9f977deedef11859","original_commit_id":"1c7be9d9ba1218cd7436feab9f977deedef11859","user":{"login":"sopel39","id":5989165,"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},"body":"There is `PageWithPositionComparator`","created_at":"2018-05-14T08:07:40Z","updated_at":"2018-05-14T08:07:40Z","html_url":"https://github.com/prestodb/presto/pull/10608#discussion_r187865983","pull_request_url":"https://api.github.com/repos/prestodb/presto/pulls/10608","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments/187865983"},"html":{"href":"https://github.com/prestodb/presto/pull/10608#discussion_r187865983"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10608"}},"in_reply_to_id":187854848},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/10608","id":187734819,"html_url":"https://github.com/prestodb/presto/pull/10608","diff_url":"https://github.com/prestodb/presto/pull/10608.diff","patch_url":"https://github.com/prestodb/presto/pull/10608.patch","issue_url":"https://api.github.com/repos/prestodb/presto/issues/10608","number":10608,"state":"open","locked":false,"title":"Support Hive bucketed sorted tables","user":{"login":"electrum","id":9230,"avatar_url":"https://avatars1.githubusercontent.com/u/9230?v=4","gravatar_id":"","url":"https://api.github.com/users/electrum","html_url":"https://github.com/electrum","followers_url":"https://api.github.com/users/electrum/followers","following_url":"https://api.github.com/users/electrum/following{/other_user}","gists_url":"https://api.github.com/users/electrum/gists{/gist_id}","starred_url":"https://api.github.com/users/electrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electrum/subscriptions","organizations_url":"https://api.github.com/users/electrum/orgs","repos_url":"https://api.github.com/users/electrum/repos","events_url":"https://api.github.com/users/electrum/events{/privacy}","received_events_url":"https://api.github.com/users/electrum/received_events","type":"User","site_admin":false},"body":null,"created_at":"2018-05-14T06:55:59Z","updated_at":"2018-05-14T08:07:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c51bfe57de11b28b2d3bd2ce0e39da9da8d8b646","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":196992743,"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/10608/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto/pulls/10608/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/10608/comments","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/1c7be9d9ba1218cd7436feab9f977deedef11859","head":{"label":"electrum:hivesort","ref":"hivesort","sha":"1c7be9d9ba1218cd7436feab9f977deedef11859","user":{"login":"electrum","id":9230,"avatar_url":"https://avatars1.githubusercontent.com/u/9230?v=4","gravatar_id":"","url":"https://api.github.com/users/electrum","html_url":"https://github.com/electrum","followers_url":"https://api.github.com/users/electrum/followers","following_url":"https://api.github.com/users/electrum/following{/other_user}","gists_url":"https://api.github.com/users/electrum/gists{/gist_id}","starred_url":"https://api.github.com/users/electrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electrum/subscriptions","organizations_url":"https://api.github.com/users/electrum/orgs","repos_url":"https://api.github.com/users/electrum/repos","events_url":"https://api.github.com/users/electrum/events{/privacy}","received_events_url":"https://api.github.com/users/electrum/received_events","type":"User","site_admin":false},"repo":{"id":5446003,"name":"presto","full_name":"electrum/presto","owner":{"login":"electrum","id":9230,"avatar_url":"https://avatars1.githubusercontent.com/u/9230?v=4","gravatar_id":"","url":"https://api.github.com/users/electrum","html_url":"https://github.com/electrum","followers_url":"https://api.github.com/users/electrum/followers","following_url":"https://api.github.com/users/electrum/following{/other_user}","gists_url":"https://api.github.com/users/electrum/gists{/gist_id}","starred_url":"https://api.github.com/users/electrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electrum/subscriptions","organizations_url":"https://api.github.com/users/electrum/orgs","repos_url":"https://api.github.com/users/electrum/repos","events_url":"https://api.github.com/users/electrum/events{/privacy}","received_events_url":"https://api.github.com/users/electrum/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/electrum/presto","description":"Distributed SQL query engine for big data","fork":true,"url":"https://api.github.com/repos/electrum/presto","forks_url":"https://api.github.com/repos/electrum/presto/forks","keys_url":"https://api.github.com/repos/electrum/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/electrum/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/electrum/presto/teams","hooks_url":"https://api.github.com/repos/electrum/presto/hooks","issue_events_url":"https://api.github.com/repos/electrum/presto/issues/events{/number}","events_url":"https://api.github.com/repos/electrum/presto/events","assignees_url":"https://api.github.com/repos/electrum/presto/assignees{/user}","branches_url":"https://api.github.com/repos/electrum/presto/branches{/branch}","tags_url":"https://api.github.com/repos/electrum/presto/tags","blobs_url":"https://api.github.com/repos/electrum/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/electrum/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/electrum/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/electrum/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/electrum/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/electrum/presto/languages","stargazers_url":"https://api.github.com/repos/electrum/presto/stargazers","contributors_url":"https://api.github.com/repos/electrum/presto/contributors","subscribers_url":"https://api.github.com/repos/electrum/presto/subscribers","subscription_url":"https://api.github.com/repos/electrum/presto/subscription","commits_url":"https://api.github.com/repos/electrum/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/electrum/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/electrum/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/electrum/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/electrum/presto/contents/{+path}","compare_url":"https://api.github.com/repos/electrum/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/electrum/presto/merges","archive_url":"https://api.github.com/repos/electrum/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/electrum/presto/downloads","issues_url":"https://api.github.com/repos/electrum/presto/issues{/number}","pulls_url":"https://api.github.com/repos/electrum/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/electrum/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/electrum/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/electrum/presto/labels{/name}","releases_url":"https://api.github.com/repos/electrum/presto/releases{/id}","deployments_url":"https://api.github.com/repos/electrum/presto/deployments","created_at":"2012-08-16T23:46:05Z","updated_at":"2018-05-01T22:43:50Z","pushed_at":"2018-05-14T06:55:46Z","git_url":"git://github.com/electrum/presto.git","ssh_url":"git@github.com:electrum/presto.git","clone_url":"https://github.com/electrum/presto.git","svn_url":"https://github.com/electrum/presto","homepage":"http://prestodb.io/","size":93183,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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"},"forks":3,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"prestodb:master","ref":"master","sha":"b06f061b1a1c38f057ee3dc3d72b77ff8270a864","user":{"login":"prestodb","id":6882181,"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,"name":"presto","full_name":"prestodb/presto","owner":{"login":"prestodb","id":6882181,"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-05-14T07:57:20Z","pushed_at":"2018-05-14T06:56:00Z","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":91176,"stargazers_count":7486,"watchers_count":7486,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2517,"mirror_url":null,"archived":false,"open_issues_count":1281,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2517,"open_issues":1281,"watchers":7486,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10608"},"html":{"href":"https://github.com/prestodb/presto/pull/10608"},"issue":{"href":"https://api.github.com/repos/prestodb/presto/issues/10608"},"comments":{"href":"https://api.github.com/repos/prestodb/presto/issues/10608/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10608/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10608/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto/statuses/1c7be9d9ba1218cd7436feab9f977deedef11859"}},"author_association":"OWNER"}}
{"actor":{"display_login":"sopel39"}}