{"action":"created","comment":{"url":"https://api.github.com/repos/kite-sdk/kite/pulls/comments/34171254","id":34171254,"diff_hunk":"@@ -231,6 +232,38 @@ public static Target asTarget(URI uri) {\n     }\n   }\n \n+  public static <E, K> PCollection<E> partitionAndSort(PCollection<E> collection,\n+      View<E> view, MapFn<E, GenericData.Record> getSortKeyFn, Schema sortKeySchema) {\n+    return partitionAndSort(collection, view, getSortKeyFn, sortKeySchema, -1);\n+  }\n+\n+  public static <E, K> PCollection<E> partitionAndSort(PCollection<E> collection,\n+      View<E> view, MapFn<E, GenericData.Record> getSortKeyFn, Schema sortKeySchema,\n+      int numWriters) {\n+    return partitionAndSort(collection, view, getSortKeyFn, sortKeySchema, numWriters, 1);\n+  }\n+\n+  public static <E, K> PCollection<E> partitionAndSort(PCollection<E> collection,\n+      View<E> view, MapFn<E, GenericData.Record> getSortKeyFn, Schema sortKeySchema,","path":"kite-data/kite-data-crunch/src/main/java/org/kitesdk/data/crunch/CrunchDatasets.java","position":24,"original_position":24,"commit_id":"38a4d9cb1fab39b63f49fc7ab889a44f7a8be156","original_commit_id":"38a4d9cb1fab39b63f49fc7ab889a44f7a8be156","user":{"login":"rdblue","id":87915,"avatar_url":"https://avatars.githubusercontent.com/u/87915?v=3","gravatar_id":"","url":"https://api.github.com/users/rdblue","html_url":"https://github.com/rdblue","followers_url":"https://api.github.com/users/rdblue/followers","following_url":"https://api.github.com/users/rdblue/following{/other_user}","gists_url":"https://api.github.com/users/rdblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rdblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdblue/subscriptions","organizations_url":"https://api.github.com/users/rdblue/orgs","repos_url":"https://api.github.com/users/rdblue/repos","events_url":"https://api.github.com/users/rdblue/events{/privacy}","received_events_url":"https://api.github.com/users/rdblue/received_events","type":"User","site_admin":false},"body":"Can this be something other than GenericData.Record? It would be nice to parameterize this and allow the caller to pass in a PType<S> for the sort key rather than a Schema. There are a lot of cases where the caller just wants to extract a single field for the sort.\r\n\r\nSpeaking of extracting a single field, that may be a valuable variant as well: `partitionAndSort(PCollection, View, String fieldName)`  That doesn't need to go into this commit though.","created_at":"2015-07-08T16:59:04Z","updated_at":"2015-07-08T16:59:04Z","html_url":"https://github.com/kite-sdk/kite/pull/393#discussion_r34171254","pull_request_url":"https://api.github.com/repos/kite-sdk/kite/pulls/393","_links":{"self":{"href":"https://api.github.com/repos/kite-sdk/kite/pulls/comments/34171254"},"html":{"href":"https://github.com/kite-sdk/kite/pull/393#discussion_r34171254"},"pull_request":{"href":"https://api.github.com/repos/kite-sdk/kite/pulls/393"}}},"pull_request":{"url":"https://api.github.com/repos/kite-sdk/kite/pulls/393","id":39377436,"html_url":"https://github.com/kite-sdk/kite/pull/393","diff_url":"https://github.com/kite-sdk/kite/pull/393.diff","patch_url":"https://github.com/kite-sdk/kite/pull/393.patch","issue_url":"https://api.github.com/repos/kite-sdk/kite/issues/393","number":393,"state":"open","locked":false,"title":"Add partitionAndSort","user":{"login":"tomwhite","id":85085,"avatar_url":"https://avatars.githubusercontent.com/u/85085?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwhite","html_url":"https://github.com/tomwhite","followers_url":"https://api.github.com/users/tomwhite/followers","following_url":"https://api.github.com/users/tomwhite/following{/other_user}","gists_url":"https://api.github.com/users/tomwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwhite/subscriptions","organizations_url":"https://api.github.com/users/tomwhite/orgs","repos_url":"https://api.github.com/users/tomwhite/repos","events_url":"https://api.github.com/users/tomwhite/events{/privacy}","received_events_url":"https://api.github.com/users/tomwhite/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-07T14:41:09Z","updated_at":"2015-07-08T16:59:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a530f3bdf598eb02089f37806ce14d831cd0fc09","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kite-sdk/kite/pulls/393/commits","review_comments_url":"https://api.github.com/repos/kite-sdk/kite/pulls/393/comments","review_comment_url":"https://api.github.com/repos/kite-sdk/kite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kite-sdk/kite/issues/393/comments","statuses_url":"https://api.github.com/repos/kite-sdk/kite/statuses/38a4d9cb1fab39b63f49fc7ab889a44f7a8be156","head":{"label":"tomwhite:KITE-1032-sort-in-partition","ref":"KITE-1032-sort-in-partition","sha":"38a4d9cb1fab39b63f49fc7ab889a44f7a8be156","user":{"login":"tomwhite","id":85085,"avatar_url":"https://avatars.githubusercontent.com/u/85085?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwhite","html_url":"https://github.com/tomwhite","followers_url":"https://api.github.com/users/tomwhite/followers","following_url":"https://api.github.com/users/tomwhite/following{/other_user}","gists_url":"https://api.github.com/users/tomwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwhite/subscriptions","organizations_url":"https://api.github.com/users/tomwhite/orgs","repos_url":"https://api.github.com/users/tomwhite/repos","events_url":"https://api.github.com/users/tomwhite/events{/privacy}","received_events_url":"https://api.github.com/users/tomwhite/received_events","type":"User","site_admin":false},"repo":{"id":15314936,"name":"kite","full_name":"tomwhite/kite","owner":{"login":"tomwhite","id":85085,"avatar_url":"https://avatars.githubusercontent.com/u/85085?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwhite","html_url":"https://github.com/tomwhite","followers_url":"https://api.github.com/users/tomwhite/followers","following_url":"https://api.github.com/users/tomwhite/following{/other_user}","gists_url":"https://api.github.com/users/tomwhite/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwhite/subscriptions","organizations_url":"https://api.github.com/users/tomwhite/orgs","repos_url":"https://api.github.com/users/tomwhite/repos","events_url":"https://api.github.com/users/tomwhite/events{/privacy}","received_events_url":"https://api.github.com/users/tomwhite/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomwhite/kite","description":"Kite SDK","fork":true,"url":"https://api.github.com/repos/tomwhite/kite","forks_url":"https://api.github.com/repos/tomwhite/kite/forks","keys_url":"https://api.github.com/repos/tomwhite/kite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomwhite/kite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomwhite/kite/teams","hooks_url":"https://api.github.com/repos/tomwhite/kite/hooks","issue_events_url":"https://api.github.com/repos/tomwhite/kite/issues/events{/number}","events_url":"https://api.github.com/repos/tomwhite/kite/events","assignees_url":"https://api.github.com/repos/tomwhite/kite/assignees{/user}","branches_url":"https://api.github.com/repos/tomwhite/kite/branches{/branch}","tags_url":"https://api.github.com/repos/tomwhite/kite/tags","blobs_url":"https://api.github.com/repos/tomwhite/kite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomwhite/kite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomwhite/kite/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomwhite/kite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomwhite/kite/statuses/{sha}","languages_url":"https://api.github.com/repos/tomwhite/kite/languages","stargazers_url":"https://api.github.com/repos/tomwhite/kite/stargazers","contributors_url":"https://api.github.com/repos/tomwhite/kite/contributors","subscribers_url":"https://api.github.com/repos/tomwhite/kite/subscribers","subscription_url":"https://api.github.com/repos/tomwhite/kite/subscription","commits_url":"https://api.github.com/repos/tomwhite/kite/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomwhite/kite/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomwhite/kite/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomwhite/kite/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomwhite/kite/contents/{+path}","compare_url":"https://api.github.com/repos/tomwhite/kite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomwhite/kite/merges","archive_url":"https://api.github.com/repos/tomwhite/kite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomwhite/kite/downloads","issues_url":"https://api.github.com/repos/tomwhite/kite/issues{/number}","pulls_url":"https://api.github.com/repos/tomwhite/kite/pulls{/number}","milestones_url":"https://api.github.com/repos/tomwhite/kite/milestones{/number}","notifications_url":"https://api.github.com/repos/tomwhite/kite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomwhite/kite/labels{/name}","releases_url":"https://api.github.com/repos/tomwhite/kite/releases{/id}","created_at":"2013-12-19T15:18:50Z","updated_at":"2014-06-23T16:26:56Z","pushed_at":"2015-07-07T14:39:35Z","git_url":"git://github.com/tomwhite/kite.git","ssh_url":"git@github.com:tomwhite/kite.git","clone_url":"https://github.com/tomwhite/kite.git","svn_url":"https://github.com/tomwhite/kite","homepage":"http://kitesdk.org/docs/current/","size":34765,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kite-sdk:master","ref":"master","sha":"a72b7b8ceb1815365c7ab76a13035832785a0cd8","user":{"login":"kite-sdk","id":5732728,"avatar_url":"https://avatars.githubusercontent.com/u/5732728?v=3","gravatar_id":"","url":"https://api.github.com/users/kite-sdk","html_url":"https://github.com/kite-sdk","followers_url":"https://api.github.com/users/kite-sdk/followers","following_url":"https://api.github.com/users/kite-sdk/following{/other_user}","gists_url":"https://api.github.com/users/kite-sdk/gists{/gist_id}","starred_url":"https://api.github.com/users/kite-sdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kite-sdk/subscriptions","organizations_url":"https://api.github.com/users/kite-sdk/orgs","repos_url":"https://api.github.com/users/kite-sdk/repos","events_url":"https://api.github.com/users/kite-sdk/events{/privacy}","received_events_url":"https://api.github.com/users/kite-sdk/received_events","type":"Organization","site_admin":false},"repo":{"id":14829187,"name":"kite","full_name":"kite-sdk/kite","owner":{"login":"kite-sdk","id":5732728,"avatar_url":"https://avatars.githubusercontent.com/u/5732728?v=3","gravatar_id":"","url":"https://api.github.com/users/kite-sdk","html_url":"https://github.com/kite-sdk","followers_url":"https://api.github.com/users/kite-sdk/followers","following_url":"https://api.github.com/users/kite-sdk/following{/other_user}","gists_url":"https://api.github.com/users/kite-sdk/gists{/gist_id}","starred_url":"https://api.github.com/users/kite-sdk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kite-sdk/subscriptions","organizations_url":"https://api.github.com/users/kite-sdk/orgs","repos_url":"https://api.github.com/users/kite-sdk/repos","events_url":"https://api.github.com/users/kite-sdk/events{/privacy}","received_events_url":"https://api.github.com/users/kite-sdk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kite-sdk/kite","description":"Kite SDK","fork":false,"url":"https://api.github.com/repos/kite-sdk/kite","forks_url":"https://api.github.com/repos/kite-sdk/kite/forks","keys_url":"https://api.github.com/repos/kite-sdk/kite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kite-sdk/kite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kite-sdk/kite/teams","hooks_url":"https://api.github.com/repos/kite-sdk/kite/hooks","issue_events_url":"https://api.github.com/repos/kite-sdk/kite/issues/events{/number}","events_url":"https://api.github.com/repos/kite-sdk/kite/events","assignees_url":"https://api.github.com/repos/kite-sdk/kite/assignees{/user}","branches_url":"https://api.github.com/repos/kite-sdk/kite/branches{/branch}","tags_url":"https://api.github.com/repos/kite-sdk/kite/tags","blobs_url":"https://api.github.com/repos/kite-sdk/kite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kite-sdk/kite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kite-sdk/kite/git/refs{/sha}","trees_url":"https://api.github.com/repos/kite-sdk/kite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kite-sdk/kite/statuses/{sha}","languages_url":"https://api.github.com/repos/kite-sdk/kite/languages","stargazers_url":"https://api.github.com/repos/kite-sdk/kite/stargazers","contributors_url":"https://api.github.com/repos/kite-sdk/kite/contributors","subscribers_url":"https://api.github.com/repos/kite-sdk/kite/subscribers","subscription_url":"https://api.github.com/repos/kite-sdk/kite/subscription","commits_url":"https://api.github.com/repos/kite-sdk/kite/commits{/sha}","git_commits_url":"https://api.github.com/repos/kite-sdk/kite/git/commits{/sha}","comments_url":"https://api.github.com/repos/kite-sdk/kite/comments{/number}","issue_comment_url":"https://api.github.com/repos/kite-sdk/kite/issues/comments{/number}","contents_url":"https://api.github.com/repos/kite-sdk/kite/contents/{+path}","compare_url":"https://api.github.com/repos/kite-sdk/kite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kite-sdk/kite/merges","archive_url":"https://api.github.com/repos/kite-sdk/kite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kite-sdk/kite/downloads","issues_url":"https://api.github.com/repos/kite-sdk/kite/issues{/number}","pulls_url":"https://api.github.com/repos/kite-sdk/kite/pulls{/number}","milestones_url":"https://api.github.com/repos/kite-sdk/kite/milestones{/number}","notifications_url":"https://api.github.com/repos/kite-sdk/kite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kite-sdk/kite/labels{/name}","releases_url":"https://api.github.com/repos/kite-sdk/kite/releases{/id}","created_at":"2013-11-30T22:06:02Z","updated_at":"2015-07-07T21:25:49Z","pushed_at":"2015-07-07T14:41:10Z","git_url":"git://github.com/kite-sdk/kite.git","ssh_url":"git@github.com:kite-sdk/kite.git","clone_url":"https://github.com/kite-sdk/kite.git","svn_url":"https://github.com/kite-sdk/kite","homepage":"http://kitesdk.org/docs/current/","size":76928,"stargazers_count":140,"watchers_count":140,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":115,"mirror_url":null,"open_issues_count":18,"forks":115,"open_issues":18,"watchers":140,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kite-sdk/kite/pulls/393"},"html":{"href":"https://github.com/kite-sdk/kite/pull/393"},"issue":{"href":"https://api.github.com/repos/kite-sdk/kite/issues/393"},"comments":{"href":"https://api.github.com/repos/kite-sdk/kite/issues/393/comments"},"review_comments":{"href":"https://api.github.com/repos/kite-sdk/kite/pulls/393/comments"},"review_comment":{"href":"https://api.github.com/repos/kite-sdk/kite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kite-sdk/kite/pulls/393/commits"},"statuses":{"href":"https://api.github.com/repos/kite-sdk/kite/statuses/38a4d9cb1fab39b63f49fc7ab889a44f7a8be156"}}}}