{"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/28648842","id":28648842,"diff_hunk":"@@ -16,30 +16,48 @@\n \n package co.cask.cdap.templates.etl.batch.sinks;\n \n-import co.cask.cdap.api.dataset.DatasetProperties;\n+import co.cask.cdap.api.data.format.StructuredRecord;\n+import co.cask.cdap.api.dataset.lib.KeyValue;\n import co.cask.cdap.api.dataset.table.Put;\n import co.cask.cdap.api.dataset.table.Table;\n+import co.cask.cdap.templates.etl.api.Emitter;\n import co.cask.cdap.templates.etl.api.Property;\n import co.cask.cdap.templates.etl.api.StageConfigurer;\n import co.cask.cdap.templates.etl.api.batch.BatchSinkWriter;\n import co.cask.cdap.templates.etl.api.config.ETLStage;\n+import co.cask.cdap.templates.etl.common.RecordPutTransformer;\n+import com.google.common.base.Preconditions;\n+import com.google.common.base.Strings;\n \n /**\n  * CDAP Table Dataset Batch Sink.\n  */\n-public class TableSink extends BatchWritableSink<Put, byte[], Put> {\n+public class TableSink extends BatchWritableSink<StructuredRecord, byte[], Put> {\n+  private RecordPutTransformer recordPutTransformer;\n \n   @Override\n   public void configure(StageConfigurer configurer) {\n     configurer.setName(\"TableSink\");\n     configurer.setDescription(\"CDAP Table Dataset Batch Sink\");\n-    configurer.addProperty(new Property(NAME, \"Name of the table. If the table does not already exist,\" +\n-      \" one will be created.\", true));\n-    configurer.addProperty(\n-      new Property(DatasetProperties.SCHEMA,\n-                   \"Optional schema of the table as a JSON Object. If the table does not already exist,\" +\n-                     \" one will be created with this schema, which will allow the table to be explored through Hive.\",\n-                   false));\n+    configurer.addProperty(new Property(\n+      NAME, \"Name of the table. If the table does not already exist, one will be created.\", true));\n+    configurer.addProperty(new Property(\n+      Table.PROPERTY_SCHEMA,\n+      \"Optional schema of the table as a JSON Object. If the table does not already exist,\" +\n+        \" one will be created with this schema, which will allow the table to be explored through Hive.\",\n+      false));\n+    configurer.addProperty(new Property(\n+      Table.PROPERTY_SCHEMA_ROW_FIELD,\n+      \"the name of the record field that should be used as the row key when writing to the table.\",\n+      true));\n+  }\n+\n+  @Override\n+  public void initialize(ETLStage stageConfig) {","path":"cdap-app-templates/cdap-etl/cdap-etl-lib/src/main/java/co/cask/cdap/templates/etl/batch/sinks/TableSink.java","position":50,"original_position":50,"commit_id":"a372d735d7153053ce54fb89085954918e7e3f7c","original_commit_id":"a372d735d7153053ce54fb89085954918e7e3f7c","user":{"login":"gokulavasan","id":558459,"avatar_url":"https://avatars.githubusercontent.com/u/558459?v=3","gravatar_id":"","url":"https://api.github.com/users/gokulavasan","html_url":"https://github.com/gokulavasan","followers_url":"https://api.github.com/users/gokulavasan/followers","following_url":"https://api.github.com/users/gokulavasan/following{/other_user}","gists_url":"https://api.github.com/users/gokulavasan/gists{/gist_id}","starred_url":"https://api.github.com/users/gokulavasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gokulavasan/subscriptions","organizations_url":"https://api.github.com/users/gokulavasan/orgs","repos_url":"https://api.github.com/users/gokulavasan/repos","events_url":"https://api.github.com/users/gokulavasan/events{/privacy}","received_events_url":"https://api.github.com/users/gokulavasan/received_events","type":"User","site_admin":false},"body":"Should we allow it to throw exception in initialize method similar to initialize method in RealtimeSource/RealtimeSink and CDAP programs?","created_at":"2015-04-19T00:59:41Z","updated_at":"2015-04-19T00:59:41Z","html_url":"https://github.com/caskdata/cdap/pull/2106#discussion_r28648842","pull_request_url":"https://api.github.com/repos/caskdata/cdap/pulls/2106","_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/28648842"},"html":{"href":"https://github.com/caskdata/cdap/pull/2106#discussion_r28648842"},"pull_request":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/2106"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/2106","id":33611399,"html_url":"https://github.com/caskdata/cdap/pull/2106","diff_url":"https://github.com/caskdata/cdap/pull/2106.diff","patch_url":"https://github.com/caskdata/cdap/pull/2106.patch","issue_url":"https://api.github.com/repos/caskdata/cdap/issues/2106","number":2106,"state":"open","locked":false,"title":"CDAP-2145 some follow up refactoring. Moving transform as a","user":{"login":"albertshau","id":5215004,"avatar_url":"https://avatars.githubusercontent.com/u/5215004?v=3","gravatar_id":"","url":"https://api.github.com/users/albertshau","html_url":"https://github.com/albertshau","followers_url":"https://api.github.com/users/albertshau/followers","following_url":"https://api.github.com/users/albertshau/following{/other_user}","gists_url":"https://api.github.com/users/albertshau/gists{/gist_id}","starred_url":"https://api.github.com/users/albertshau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertshau/subscriptions","organizations_url":"https://api.github.com/users/albertshau/orgs","repos_url":"https://api.github.com/users/albertshau/repos","events_url":"https://api.github.com/users/albertshau/events{/privacy}","received_events_url":"https://api.github.com/users/albertshau/received_events","type":"User","site_admin":false},"body":"separate interface, and having BatchSource and BatchSink\r\nimplement Transform. Also moving source and sink related\r\ntransforms into their corresponding source and sink.","created_at":"2015-04-19T00:42:29Z","updated_at":"2015-04-19T00:59:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"511ad77a2f45a02145caabf9f87eeee144634afe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/cdap/pulls/2106/commits","review_comments_url":"https://api.github.com/repos/caskdata/cdap/pulls/2106/comments","review_comment_url":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caskdata/cdap/issues/2106/comments","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/a372d735d7153053ce54fb89085954918e7e3f7c","head":{"label":"caskdata:feature-adapter/CDAP-2145-follow-up-etl-api-updates","ref":"feature-adapter/CDAP-2145-follow-up-etl-api-updates","sha":"a372d735d7153053ce54fb89085954918e7e3f7c","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}","created_at":"2014-08-02T09:00:10Z","updated_at":"2015-04-19T00:55:37Z","pushed_at":"2015-04-19T00:59:11Z","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":845847,"stargazers_count":41,"watchers_count":41,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":23,"forks":13,"open_issues":23,"watchers":41,"default_branch":"develop"}},"base":{"label":"caskdata:develop","ref":"develop","sha":"2409da33beb2f3d48b2a31346e919c9bd536c8c6","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}","created_at":"2014-08-02T09:00:10Z","updated_at":"2015-04-19T00:55:37Z","pushed_at":"2015-04-19T00:59:11Z","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":845847,"stargazers_count":41,"watchers_count":41,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":23,"forks":13,"open_issues":23,"watchers":41,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/2106"},"html":{"href":"https://github.com/caskdata/cdap/pull/2106"},"issue":{"href":"https://api.github.com/repos/caskdata/cdap/issues/2106"},"comments":{"href":"https://api.github.com/repos/caskdata/cdap/issues/2106/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/2106/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/2106/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/cdap/statuses/a372d735d7153053ce54fb89085954918e7e3f7c"}}}}