{"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/comments/77890171","id":77890171,"diff_hunk":"@@ -0,0 +1,127 @@\n+/*\n+ * Copyright © 2016 Cask Data, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n+ * use this file except in compliance with the License. You may obtain a copy of\n+ * 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, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package co.cask.hydrator.plugin.spark;\n+\n+import co.cask.cdap.api.annotation.Description;\n+import co.cask.cdap.api.annotation.Name;\n+import co.cask.cdap.api.annotation.Plugin;\n+import co.cask.cdap.api.data.format.StructuredRecord;\n+import co.cask.cdap.api.data.schema.Schema;\n+import co.cask.cdap.api.plugin.PluginConfig;\n+import co.cask.cdap.etl.api.PipelineConfigurer;\n+import co.cask.cdap.etl.api.batch.SparkCompute;\n+import co.cask.cdap.etl.api.batch.SparkExecutionPluginContext;\n+import com.google.common.base.Preconditions;\n+import org.apache.spark.api.java.JavaRDD;\n+import org.apache.spark.api.java.JavaSparkContext;\n+import org.apache.spark.api.java.function.Function;\n+import org.apache.spark.ml.feature.RegexTokenizer;\n+import org.apache.spark.sql.DataFrame;\n+import org.apache.spark.sql.Row;\n+import org.apache.spark.sql.RowFactory;\n+import org.apache.spark.sql.SQLContext;\n+import org.apache.spark.sql.types.DataTypes;\n+import org.apache.spark.sql.types.Metadata;\n+import org.apache.spark.sql.types.StructField;\n+import org.apache.spark.sql.types.StructType;\n+\n+/**\n+ * Tokenizer-SparkCompute that breaks text(such as sentence) into individual terms(usually words)\n+ */\n+@Plugin(type = SparkCompute.PLUGIN_TYPE)\n+@Name(Tokenizer.PLUGIN_NAME)\n+@Description(\"Used to tokenize text(such as sentence) into individual terms(usually words)\")\n+public class Tokenizer extends SparkCompute<StructuredRecord, StructuredRecord> {\n+\n+    public static final String PLUGIN_NAME = \"Tokenizer\";\n+    private Config config;\n+    public Schema outputSchema;\n+\n+    public Tokenizer(Config config) {\n+        this.config = config;\n+    }\n+\n+    /**\n+     * Configuration for the Tokenizer Plugin.\n+     */\n+    public static class Config extends PluginConfig {\n+        @Description(\"Column on which tokenization is to be done\")\n+        private final String columnToBeTokenized;\n+\n+        @Description(\"Delimiter for tokenization\")\n+        private final String delimiter;","path":"spark-plugins/src/main/java/co/cask/hydrator/plugin/spark/Tokenizer.java","position":66,"original_position":66,"commit_id":"56e88487246b4af137cb777e44e4900bb82cbe39","original_commit_id":"56e88487246b4af137cb777e44e4900bb82cbe39","user":{"login":"sagarkapare","id":5713570,"avatar_url":"https://avatars.githubusercontent.com/u/5713570?v=3","gravatar_id":"","url":"https://api.github.com/users/sagarkapare","html_url":"https://github.com/sagarkapare","followers_url":"https://api.github.com/users/sagarkapare/followers","following_url":"https://api.github.com/users/sagarkapare/following{/other_user}","gists_url":"https://api.github.com/users/sagarkapare/gists{/gist_id}","starred_url":"https://api.github.com/users/sagarkapare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagarkapare/subscriptions","organizations_url":"https://api.github.com/users/sagarkapare/orgs","repos_url":"https://api.github.com/users/sagarkapare/repos","events_url":"https://api.github.com/users/sagarkapare/events{/privacy}","received_events_url":"https://api.github.com/users/sagarkapare/received_events","type":"User","site_admin":false},"body":"Do we accept the complex regex for the tokenization? If so better to rename this variable something like `pattern` and add in the description?","created_at":"2016-09-07T19:43:19Z","updated_at":"2016-09-07T19:43:19Z","html_url":"https://github.com/caskdata/hydrator-plugins/pull/424#discussion_r77890171","pull_request_url":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424","_links":{"self":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/comments/77890171"},"html":{"href":"https://github.com/caskdata/hydrator-plugins/pull/424#discussion_r77890171"},"pull_request":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424","id":82158591,"html_url":"https://github.com/caskdata/hydrator-plugins/pull/424","diff_url":"https://github.com/caskdata/hydrator-plugins/pull/424.diff","patch_url":"https://github.com/caskdata/hydrator-plugins/pull/424.patch","issue_url":"https://api.github.com/repos/caskdata/hydrator-plugins/issues/424","number":424,"state":"open","locked":false,"title":"[CDAP-6989] Tokenizer Implementation","user":{"login":"shashankmoghe","id":20435815,"avatar_url":"https://avatars.githubusercontent.com/u/20435815?v=3","gravatar_id":"","url":"https://api.github.com/users/shashankmoghe","html_url":"https://github.com/shashankmoghe","followers_url":"https://api.github.com/users/shashankmoghe/followers","following_url":"https://api.github.com/users/shashankmoghe/following{/other_user}","gists_url":"https://api.github.com/users/shashankmoghe/gists{/gist_id}","starred_url":"https://api.github.com/users/shashankmoghe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shashankmoghe/subscriptions","organizations_url":"https://api.github.com/users/shashankmoghe/orgs","repos_url":"https://api.github.com/users/shashankmoghe/repos","events_url":"https://api.github.com/users/shashankmoghe/events{/privacy}","received_events_url":"https://api.github.com/users/shashankmoghe/received_events","type":"User","site_admin":false},"body":"1.Tokenizer implementation,JUnit,Widget,Documentation\r\n2.Spark version changed to 1.6.1\r\n","created_at":"2016-08-22T09:25:14Z","updated_at":"2016-09-07T19:43:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dac37ebb3c5f9a4c69f7732e826cb1e2c95cf9aa","assignee":{"login":"sagarkapare","id":5713570,"avatar_url":"https://avatars.githubusercontent.com/u/5713570?v=3","gravatar_id":"","url":"https://api.github.com/users/sagarkapare","html_url":"https://github.com/sagarkapare","followers_url":"https://api.github.com/users/sagarkapare/followers","following_url":"https://api.github.com/users/sagarkapare/following{/other_user}","gists_url":"https://api.github.com/users/sagarkapare/gists{/gist_id}","starred_url":"https://api.github.com/users/sagarkapare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagarkapare/subscriptions","organizations_url":"https://api.github.com/users/sagarkapare/orgs","repos_url":"https://api.github.com/users/sagarkapare/repos","events_url":"https://api.github.com/users/sagarkapare/events{/privacy}","received_events_url":"https://api.github.com/users/sagarkapare/received_events","type":"User","site_admin":false},"assignees":[{"login":"sagarkapare","id":5713570,"avatar_url":"https://avatars.githubusercontent.com/u/5713570?v=3","gravatar_id":"","url":"https://api.github.com/users/sagarkapare","html_url":"https://github.com/sagarkapare","followers_url":"https://api.github.com/users/sagarkapare/followers","following_url":"https://api.github.com/users/sagarkapare/following{/other_user}","gists_url":"https://api.github.com/users/sagarkapare/gists{/gist_id}","starred_url":"https://api.github.com/users/sagarkapare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagarkapare/subscriptions","organizations_url":"https://api.github.com/users/sagarkapare/orgs","repos_url":"https://api.github.com/users/sagarkapare/repos","events_url":"https://api.github.com/users/sagarkapare/events{/privacy}","received_events_url":"https://api.github.com/users/sagarkapare/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424/commits","review_comments_url":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424/comments","review_comment_url":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caskdata/hydrator-plugins/issues/424/comments","statuses_url":"https://api.github.com/repos/caskdata/hydrator-plugins/statuses/56e88487246b4af137cb777e44e4900bb82cbe39","head":{"label":"shashankmoghe:feature/tokenizer","ref":"feature/tokenizer","sha":"56e88487246b4af137cb777e44e4900bb82cbe39","user":{"login":"shashankmoghe","id":20435815,"avatar_url":"https://avatars.githubusercontent.com/u/20435815?v=3","gravatar_id":"","url":"https://api.github.com/users/shashankmoghe","html_url":"https://github.com/shashankmoghe","followers_url":"https://api.github.com/users/shashankmoghe/followers","following_url":"https://api.github.com/users/shashankmoghe/following{/other_user}","gists_url":"https://api.github.com/users/shashankmoghe/gists{/gist_id}","starred_url":"https://api.github.com/users/shashankmoghe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shashankmoghe/subscriptions","organizations_url":"https://api.github.com/users/shashankmoghe/orgs","repos_url":"https://api.github.com/users/shashankmoghe/repos","events_url":"https://api.github.com/users/shashankmoghe/events{/privacy}","received_events_url":"https://api.github.com/users/shashankmoghe/received_events","type":"User","site_admin":false},"repo":{"id":65281984,"name":"hydrator-plugins","full_name":"shashankmoghe/hydrator-plugins","owner":{"login":"shashankmoghe","id":20435815,"avatar_url":"https://avatars.githubusercontent.com/u/20435815?v=3","gravatar_id":"","url":"https://api.github.com/users/shashankmoghe","html_url":"https://github.com/shashankmoghe","followers_url":"https://api.github.com/users/shashankmoghe/followers","following_url":"https://api.github.com/users/shashankmoghe/following{/other_user}","gists_url":"https://api.github.com/users/shashankmoghe/gists{/gist_id}","starred_url":"https://api.github.com/users/shashankmoghe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shashankmoghe/subscriptions","organizations_url":"https://api.github.com/users/shashankmoghe/orgs","repos_url":"https://api.github.com/users/shashankmoghe/repos","events_url":"https://api.github.com/users/shashankmoghe/events{/privacy}","received_events_url":"https://api.github.com/users/shashankmoghe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shashankmoghe/hydrator-plugins","description":"Cask Hydrator Plugins Repository","fork":true,"url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins","forks_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/forks","keys_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/teams","hooks_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/hooks","issue_events_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/events","assignees_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/tags","blobs_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/languages","stargazers_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/stargazers","contributors_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/contributors","subscribers_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/subscribers","subscription_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/subscription","commits_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/merges","archive_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/downloads","issues_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/labels{/name}","releases_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/releases{/id}","deployments_url":"https://api.github.com/repos/shashankmoghe/hydrator-plugins/deployments","created_at":"2016-08-09T09:26:22Z","updated_at":"2016-08-09T09:26:24Z","pushed_at":"2016-09-01T08:46:09Z","git_url":"git://github.com/shashankmoghe/hydrator-plugins.git","ssh_url":"git@github.com:shashankmoghe/hydrator-plugins.git","clone_url":"https://github.com/shashankmoghe/hydrator-plugins.git","svn_url":"https://github.com/shashankmoghe/hydrator-plugins","homepage":"","size":3630,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"release/1.4"}},"base":{"label":"caskdata:develop","ref":"develop","sha":"5e027172ecbb6685feb9b0fa039606b1c7789af8","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":39922362,"name":"hydrator-plugins","full_name":"caskdata/hydrator-plugins","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/hydrator-plugins","description":"Cask Hydrator Plugins Repository","fork":false,"url":"https://api.github.com/repos/caskdata/hydrator-plugins","forks_url":"https://api.github.com/repos/caskdata/hydrator-plugins/forks","keys_url":"https://api.github.com/repos/caskdata/hydrator-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/hydrator-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/hydrator-plugins/teams","hooks_url":"https://api.github.com/repos/caskdata/hydrator-plugins/hooks","issue_events_url":"https://api.github.com/repos/caskdata/hydrator-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/hydrator-plugins/events","assignees_url":"https://api.github.com/repos/caskdata/hydrator-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/hydrator-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/hydrator-plugins/tags","blobs_url":"https://api.github.com/repos/caskdata/hydrator-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/hydrator-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/hydrator-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/hydrator-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/hydrator-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/hydrator-plugins/languages","stargazers_url":"https://api.github.com/repos/caskdata/hydrator-plugins/stargazers","contributors_url":"https://api.github.com/repos/caskdata/hydrator-plugins/contributors","subscribers_url":"https://api.github.com/repos/caskdata/hydrator-plugins/subscribers","subscription_url":"https://api.github.com/repos/caskdata/hydrator-plugins/subscription","commits_url":"https://api.github.com/repos/caskdata/hydrator-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/hydrator-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/hydrator-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/hydrator-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/hydrator-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/hydrator-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/hydrator-plugins/merges","archive_url":"https://api.github.com/repos/caskdata/hydrator-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/hydrator-plugins/downloads","issues_url":"https://api.github.com/repos/caskdata/hydrator-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/hydrator-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/hydrator-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/hydrator-plugins/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/hydrator-plugins/releases{/id}","deployments_url":"https://api.github.com/repos/caskdata/hydrator-plugins/deployments","created_at":"2015-07-30T00:14:48Z","updated_at":"2016-09-01T16:49:07Z","pushed_at":"2016-09-07T19:34:50Z","git_url":"git://github.com/caskdata/hydrator-plugins.git","ssh_url":"git@github.com:caskdata/hydrator-plugins.git","clone_url":"https://github.com/caskdata/hydrator-plugins.git","svn_url":"https://github.com/caskdata/hydrator-plugins","homepage":"","size":4177,"stargazers_count":22,"watchers_count":22,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":15,"forks":17,"open_issues":15,"watchers":22,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424"},"html":{"href":"https://github.com/caskdata/hydrator-plugins/pull/424"},"issue":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/issues/424"},"comments":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/issues/424/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/pulls/424/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/hydrator-plugins/statuses/56e88487246b4af137cb777e44e4900bb82cbe39"}}}}
{"actor":{"display_login":"sagarkapare"}}