{"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/60824610","id":60824610,"diff_hunk":"@@ -0,0 +1,147 @@\n+.. meta::\n+    :author: Cask Data, Inc.\n+    :description: Cask Data Application Platform Clicks and Views Application\n+    :copyright: Copyright © 2016 Cask Data, Inc.\n+\n+.. _examples-clicks-and-views:\n+\n+================\n+Clicks and Views\n+================\n+\n+A Cask Data Application Platform (CDAP) example demonstrating a reduce-side join\n+across two streams, using MapReduce.\n+\n+\n+Overview\n+========\n+This application has a MapReduce which processes records in two streams and outputs to a PartitionedFileSet.\n+The ``ClicksAndViewsMapReduce`` processes the records from a ``views`` stream and a ``clicks`` stream,\n+then joining on the ``viewId`` of the records and writing the joined records to a ``joined`` PartitionedFileSet.\n+\n+Let's look at some of these components, and then run the application and see the results.\n+\n+The Clicks and Views Application\n+--------------------------------\n+As in the other :ref:`examples <examples-index>`, the components\n+of the application are tied together by the class ``ClicksAndViews``:\n+\n+.. literalinclude:: /../../../cdap-examples/ClicksAndViews/src/main/java/co/cask/cdap/examples/clicksandviews/ClicksAndViews.java\n+   :language: java\n+   :lines: 29-\n+\n+Data Storage\n+------------\n+- *views* input``Stream`` contains ad views, representing an advertisement downloaded to a viewer's screen.\n+- *clicks* input ``Stream`` contains ad clicks, representing when a viewer clicks on an advertisement.\n+- *joined* output ``PartitionedFileSetFileSet`` contains the joined ad views, which additionally contains the\n+  count of clicks each ad view has. This Dataset is partitioned on the logical start time of the MapReduce.\n+\n+MapReduce over Multiple Inputs\n+------------------------------\n+``ClicksAndViewsMapReduce`` is a MapReduce that reads from the *clicks* and *views* ``Stream``s and writes to\n+the *joined* ``PartitionedFileSet``. The ``beforeSubmit`` method prepares the MapReduce program. It sets up the\n+two ``Stream``s as input and sets up the ``PartitionedFileSet`` as output, with the appropriate ``PartitionKey``.\n+The Mapper class then keys each of the records based upon the ``viewId``. That makes it so that all clicks and views\n+for a particular ``viewId`` go to a single Reducer for joining.\n+","path":"cdap-docs/examples-manual/source/examples/clicks-and-views.rst","position":null,"original_position":47,"commit_id":"7f1009d9004d4525a29f5c0919ce21927d4c1cf5","original_commit_id":"958de14155793aebcc0889c15af3fdf2e48e296b","user":{"login":"anew","id":483004,"avatar_url":"https://avatars.githubusercontent.com/u/483004?v=3","gravatar_id":"","url":"https://api.github.com/users/anew","html_url":"https://github.com/anew","followers_url":"https://api.github.com/users/anew/followers","following_url":"https://api.github.com/users/anew/following{/other_user}","gists_url":"https://api.github.com/users/anew/gists{/gist_id}","starred_url":"https://api.github.com/users/anew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anew/subscriptions","organizations_url":"https://api.github.com/users/anew/orgs","repos_url":"https://api.github.com/users/anew/repos","events_url":"https://api.github.com/users/anew/events{/privacy}","received_events_url":"https://api.github.com/users/anew/received_events","type":"User","site_admin":false},"body":"I meant that what you had was only a description of _what_ the MR does, in a couple of lines of text, without showing the code that does it. The purpose of the example, however, is to illustrate how to use the APIs to make a MR do that. So it would be better to include code samples, and for each one, explain what it is doing. ","created_at":"2016-04-23T07:20:50Z","updated_at":"2016-04-23T07:20:50Z","html_url":"https://github.com/caskdata/cdap/pull/5623#discussion_r60824610","pull_request_url":"https://api.github.com/repos/caskdata/cdap/pulls/5623","_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/60824610"},"html":{"href":"https://github.com/caskdata/cdap/pull/5623#discussion_r60824610"},"pull_request":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5623"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/5623","id":67425399,"html_url":"https://github.com/caskdata/cdap/pull/5623","diff_url":"https://github.com/caskdata/cdap/pull/5623.diff","patch_url":"https://github.com/caskdata/cdap/pull/5623.patch","issue_url":"https://api.github.com/repos/caskdata/cdap/issues/5623","number":5623,"state":"open","locked":false,"title":"ClicksAndViews Example App","user":{"login":"anwar6953","id":2440977,"avatar_url":"https://avatars.githubusercontent.com/u/2440977?v=3","gravatar_id":"","url":"https://api.github.com/users/anwar6953","html_url":"https://github.com/anwar6953","followers_url":"https://api.github.com/users/anwar6953/followers","following_url":"https://api.github.com/users/anwar6953/following{/other_user}","gists_url":"https://api.github.com/users/anwar6953/gists{/gist_id}","starred_url":"https://api.github.com/users/anwar6953/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anwar6953/subscriptions","organizations_url":"https://api.github.com/users/anwar6953/orgs","repos_url":"https://api.github.com/users/anwar6953/repos","events_url":"https://api.github.com/users/anwar6953/events{/privacy}","received_events_url":"https://api.github.com/users/anwar6953/received_events","type":"User","site_admin":false},"body":"Implementation of ClicksAndViews example application, which demonstrates a join across two streams, using multiple inputs functionality of MapReduce.\r\n\r\nNote: Opening this PR to get feedback on the example application, while I work on the developer docs for it.\r\n\r\nPasses [Quick Build 16](http://builds.cask.co/browse/CDAP-DOB184-16)","created_at":"2016-04-21T21:28:37Z","updated_at":"2016-04-23T07:20:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9217323c8f710f190b452c7dece55536382d01ff","assignee":{"login":"anew","id":483004,"avatar_url":"https://avatars.githubusercontent.com/u/483004?v=3","gravatar_id":"","url":"https://api.github.com/users/anew","html_url":"https://github.com/anew","followers_url":"https://api.github.com/users/anew/followers","following_url":"https://api.github.com/users/anew/following{/other_user}","gists_url":"https://api.github.com/users/anew/gists{/gist_id}","starred_url":"https://api.github.com/users/anew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anew/subscriptions","organizations_url":"https://api.github.com/users/anew/orgs","repos_url":"https://api.github.com/users/anew/repos","events_url":"https://api.github.com/users/anew/events{/privacy}","received_events_url":"https://api.github.com/users/anew/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/cdap/pulls/5623/commits","review_comments_url":"https://api.github.com/repos/caskdata/cdap/pulls/5623/comments","review_comment_url":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caskdata/cdap/issues/5623/comments","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/7f1009d9004d4525a29f5c0919ce21927d4c1cf5","head":{"label":"caskdata:feature/CDAP-5238-mr-multiple-inputs-docs","ref":"feature/CDAP-5238-mr-multiple-inputs-docs","sha":"7f1009d9004d4525a29f5c0919ce21927d4c1cf5","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2016-04-19T22:42:01Z","pushed_at":"2016-04-23T07:13:24Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":605084,"stargazers_count":115,"watchers_count":115,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":40,"mirror_url":null,"open_issues_count":4,"forks":40,"open_issues":4,"watchers":115,"default_branch":"release/3.4"}},"base":{"label":"caskdata:release/3.4","ref":"release/3.4","sha":"c383d8e0fff9887027fefc8c08b8b30edc102748","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/cdap/deployments","created_at":"2014-08-02T09:00:10Z","updated_at":"2016-04-19T22:42:01Z","pushed_at":"2016-04-23T07:13:24Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":605084,"stargazers_count":115,"watchers_count":115,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":40,"mirror_url":null,"open_issues_count":4,"forks":40,"open_issues":4,"watchers":115,"default_branch":"release/3.4"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5623"},"html":{"href":"https://github.com/caskdata/cdap/pull/5623"},"issue":{"href":"https://api.github.com/repos/caskdata/cdap/issues/5623"},"comments":{"href":"https://api.github.com/repos/caskdata/cdap/issues/5623/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5623/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/5623/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/cdap/statuses/7f1009d9004d4525a29f5c0919ce21927d4c1cf5"}}}}