{"action":"created","comment":{"url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/comments/47409519","id":47409519,"diff_hunk":"@@ -0,0 +1,35 @@\n+package snapchat.analytics.sparkstreamingjob.breakingnews;\n+\n+import com.google.inject.Singleton;\n+import org.apache.spark.api.java.function.Function;\n+import scala.Tuple2;\n+import snapchat.analytics.sparkstreamingjob.sparkpipeline.AggregateResult;\n+\n+@Singleton\n+public class AggregateStoryStatsFn implements Function<Tuple2<String, Iterable<BreakingNewsStorySnapStats>>, AggregateResult> {\n+    @Override\n+    public AggregateResult call(Tuple2<String, Iterable<BreakingNewsStorySnapStats>> v1) throws Exception {\n+        AggregatedStats aggrStats = new AggregatedStats();\n+\n+        StringBuilder sb = new StringBuilder();\n+        for (BreakingNewsStorySnapStats storyStat : v1._2()) {\n+            ++ aggrStats.submitCount;\n+            sb.append(storyStat.getSessionId() + \",\");\n+        }\n+\n+        return getAggregationOutput(v1._1(), aggrStats);","path":"aggregator/src/main/java/snapchat/analytics/sparkstreamingjob/breakingnews/AggregateStoryStatsFn.java","position":20,"original_position":20,"commit_id":"222e60579866050eac9325a0c60fe0b97085b0c5","original_commit_id":"222e60579866050eac9325a0c60fe0b97085b0c5","user":{"login":"yifanlisc","id":8413655,"avatar_url":"https://avatars.githubusercontent.com/u/8413655?v=3","gravatar_id":"","url":"https://api.github.com/users/yifanlisc","html_url":"https://github.com/yifanlisc","followers_url":"https://api.github.com/users/yifanlisc/followers","following_url":"https://api.github.com/users/yifanlisc/following{/other_user}","gists_url":"https://api.github.com/users/yifanlisc/gists{/gist_id}","starred_url":"https://api.github.com/users/yifanlisc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yifanlisc/subscriptions","organizations_url":"https://api.github.com/users/yifanlisc/orgs","repos_url":"https://api.github.com/users/yifanlisc/repos","events_url":"https://api.github.com/users/yifanlisc/events{/privacy}","received_events_url":"https://api.github.com/users/yifanlisc/received_events","type":"User","site_admin":false},"body":"Yes, you are right. Bad copy/paste from DataFlow job. ","created_at":"2015-12-11T21:49:17Z","updated_at":"2015-12-11T21:49:17Z","html_url":"https://github.com/sandeepshresthasc/realtime-aggregator/pull/18#discussion_r47409519","pull_request_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/comments/47409519"},"html":{"href":"https://github.com/sandeepshresthasc/realtime-aggregator/pull/18#discussion_r47409519"},"pull_request":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18","id":53335502,"html_url":"https://github.com/sandeepshresthasc/realtime-aggregator/pull/18","diff_url":"https://github.com/sandeepshresthasc/realtime-aggregator/pull/18.diff","patch_url":"https://github.com/sandeepshresthasc/realtime-aggregator/pull/18.patch","issue_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/18","number":18,"state":"open","locked":false,"title":"Move to spark streaming","user":{"login":"yifanlisc","id":8413655,"avatar_url":"https://avatars.githubusercontent.com/u/8413655?v=3","gravatar_id":"","url":"https://api.github.com/users/yifanlisc","html_url":"https://github.com/yifanlisc","followers_url":"https://api.github.com/users/yifanlisc/followers","following_url":"https://api.github.com/users/yifanlisc/following{/other_user}","gists_url":"https://api.github.com/users/yifanlisc/gists{/gist_id}","starred_url":"https://api.github.com/users/yifanlisc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yifanlisc/subscriptions","organizations_url":"https://api.github.com/users/yifanlisc/orgs","repos_url":"https://api.github.com/users/yifanlisc/repos","events_url":"https://api.github.com/users/yifanlisc/events{/privacy}","received_events_url":"https://api.github.com/users/yifanlisc/received_events","type":"User","site_admin":false},"body":"This PR migrates the breaking news to spark streaming from DataFlow. Note that it still uses the PubSub as data source. This one allows us to do some local testing to make sure the logic is correct (which is tricky to do with Kafka). \r\n\r\nLocal testing and comparisons with DataFlow were done. ","created_at":"2015-12-10T23:53:16Z","updated_at":"2015-12-11T21:49:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33086a7b77d36e1932fb93e60879743ed3633cc2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18/commits","review_comments_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18/comments","review_comment_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/18/comments","statuses_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/statuses/222e60579866050eac9325a0c60fe0b97085b0c5","head":{"label":"sandeepshresthasc:yifanli-breakingnews-spark1","ref":"yifanli-breakingnews-spark1","sha":"222e60579866050eac9325a0c60fe0b97085b0c5","user":{"login":"sandeepshresthasc","id":12515952,"avatar_url":"https://avatars.githubusercontent.com/u/12515952?v=3","gravatar_id":"","url":"https://api.github.com/users/sandeepshresthasc","html_url":"https://github.com/sandeepshresthasc","followers_url":"https://api.github.com/users/sandeepshresthasc/followers","following_url":"https://api.github.com/users/sandeepshresthasc/following{/other_user}","gists_url":"https://api.github.com/users/sandeepshresthasc/gists{/gist_id}","starred_url":"https://api.github.com/users/sandeepshresthasc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandeepshresthasc/subscriptions","organizations_url":"https://api.github.com/users/sandeepshresthasc/orgs","repos_url":"https://api.github.com/users/sandeepshresthasc/repos","events_url":"https://api.github.com/users/sandeepshresthasc/events{/privacy}","received_events_url":"https://api.github.com/users/sandeepshresthasc/received_events","type":"User","site_admin":false},"repo":{"id":42138734,"name":"realtime-aggregator","full_name":"sandeepshresthasc/realtime-aggregator","owner":{"login":"sandeepshresthasc","id":12515952,"avatar_url":"https://avatars.githubusercontent.com/u/12515952?v=3","gravatar_id":"","url":"https://api.github.com/users/sandeepshresthasc","html_url":"https://github.com/sandeepshresthasc","followers_url":"https://api.github.com/users/sandeepshresthasc/followers","following_url":"https://api.github.com/users/sandeepshresthasc/following{/other_user}","gists_url":"https://api.github.com/users/sandeepshresthasc/gists{/gist_id}","starred_url":"https://api.github.com/users/sandeepshresthasc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandeepshresthasc/subscriptions","organizations_url":"https://api.github.com/users/sandeepshresthasc/orgs","repos_url":"https://api.github.com/users/sandeepshresthasc/repos","events_url":"https://api.github.com/users/sandeepshresthasc/events{/privacy}","received_events_url":"https://api.github.com/users/sandeepshresthasc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sandeepshresthasc/realtime-aggregator","description":"realtime aggregation on blizzard data","fork":false,"url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator","forks_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/forks","keys_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/teams","hooks_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/hooks","issue_events_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/events{/number}","events_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/events","assignees_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/assignees{/user}","branches_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/branches{/branch}","tags_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/tags","blobs_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/languages","stargazers_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/stargazers","contributors_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/contributors","subscribers_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/subscribers","subscription_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/subscription","commits_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/contents/{+path}","compare_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/merges","archive_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/downloads","issues_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues{/number}","pulls_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/labels{/name}","releases_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/releases{/id}","created_at":"2015-09-08T20:59:13Z","updated_at":"2015-10-07T01:19:25Z","pushed_at":"2015-12-11T01:57:32Z","git_url":"git://github.com/sandeepshresthasc/realtime-aggregator.git","ssh_url":"git@github.com:sandeepshresthasc/realtime-aggregator.git","clone_url":"https://github.com/sandeepshresthasc/realtime-aggregator.git","svn_url":"https://github.com/sandeepshresthasc/realtime-aggregator","homepage":null,"size":476,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"sandeepshresthasc:master","ref":"master","sha":"19548f3b1702f326156b52a2744a81b0f5793ca6","user":{"login":"sandeepshresthasc","id":12515952,"avatar_url":"https://avatars.githubusercontent.com/u/12515952?v=3","gravatar_id":"","url":"https://api.github.com/users/sandeepshresthasc","html_url":"https://github.com/sandeepshresthasc","followers_url":"https://api.github.com/users/sandeepshresthasc/followers","following_url":"https://api.github.com/users/sandeepshresthasc/following{/other_user}","gists_url":"https://api.github.com/users/sandeepshresthasc/gists{/gist_id}","starred_url":"https://api.github.com/users/sandeepshresthasc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandeepshresthasc/subscriptions","organizations_url":"https://api.github.com/users/sandeepshresthasc/orgs","repos_url":"https://api.github.com/users/sandeepshresthasc/repos","events_url":"https://api.github.com/users/sandeepshresthasc/events{/privacy}","received_events_url":"https://api.github.com/users/sandeepshresthasc/received_events","type":"User","site_admin":false},"repo":{"id":42138734,"name":"realtime-aggregator","full_name":"sandeepshresthasc/realtime-aggregator","owner":{"login":"sandeepshresthasc","id":12515952,"avatar_url":"https://avatars.githubusercontent.com/u/12515952?v=3","gravatar_id":"","url":"https://api.github.com/users/sandeepshresthasc","html_url":"https://github.com/sandeepshresthasc","followers_url":"https://api.github.com/users/sandeepshresthasc/followers","following_url":"https://api.github.com/users/sandeepshresthasc/following{/other_user}","gists_url":"https://api.github.com/users/sandeepshresthasc/gists{/gist_id}","starred_url":"https://api.github.com/users/sandeepshresthasc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandeepshresthasc/subscriptions","organizations_url":"https://api.github.com/users/sandeepshresthasc/orgs","repos_url":"https://api.github.com/users/sandeepshresthasc/repos","events_url":"https://api.github.com/users/sandeepshresthasc/events{/privacy}","received_events_url":"https://api.github.com/users/sandeepshresthasc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sandeepshresthasc/realtime-aggregator","description":"realtime aggregation on blizzard data","fork":false,"url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator","forks_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/forks","keys_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/teams","hooks_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/hooks","issue_events_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/events{/number}","events_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/events","assignees_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/assignees{/user}","branches_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/branches{/branch}","tags_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/tags","blobs_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/refs{/sha}","trees_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/statuses/{sha}","languages_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/languages","stargazers_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/stargazers","contributors_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/contributors","subscribers_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/subscribers","subscription_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/subscription","commits_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/commits{/sha}","git_commits_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/git/commits{/sha}","comments_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/comments{/number}","issue_comment_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/comments{/number}","contents_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/contents/{+path}","compare_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/merges","archive_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/downloads","issues_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues{/number}","pulls_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls{/number}","milestones_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/milestones{/number}","notifications_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/labels{/name}","releases_url":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/releases{/id}","created_at":"2015-09-08T20:59:13Z","updated_at":"2015-10-07T01:19:25Z","pushed_at":"2015-12-11T01:57:32Z","git_url":"git://github.com/sandeepshresthasc/realtime-aggregator.git","ssh_url":"git@github.com:sandeepshresthasc/realtime-aggregator.git","clone_url":"https://github.com/sandeepshresthasc/realtime-aggregator.git","svn_url":"https://github.com/sandeepshresthasc/realtime-aggregator","homepage":null,"size":476,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18"},"html":{"href":"https://github.com/sandeepshresthasc/realtime-aggregator/pull/18"},"issue":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/18"},"comments":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/sandeepshresthasc/realtime-aggregator/statuses/222e60579866050eac9325a0c60fe0b97085b0c5"}}}}