{"action":"created","comment":{"url":"https://api.github.com/repos/apache/kafka/pulls/comments/96999048","pull_request_review_id":17599590,"id":96999048,"diff_hunk":"@@ -0,0 +1,173 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ * <p/>\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ * <p/>\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ **/\n+\n+package org.apache.kafka.connect.transforms;\n+\n+import org.apache.kafka.common.config.ConfigDef;\n+import org.apache.kafka.connect.connector.ConnectRecord;\n+import org.apache.kafka.connect.data.Field;\n+import org.apache.kafka.connect.data.Schema;\n+import org.apache.kafka.connect.data.Struct;\n+import org.apache.kafka.connect.errors.DataException;\n+import org.apache.kafka.connect.transforms.util.SimpleConfig;\n+\n+import java.math.BigDecimal;\n+import java.math.BigInteger;\n+import java.util.Collections;\n+import java.util.Date;\n+import java.util.HashMap;\n+import java.util.HashSet;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.Set;\n+\n+import static org.apache.kafka.connect.transforms.util.Requirements.requireMap;\n+import static org.apache.kafka.connect.transforms.util.Requirements.requireStruct;\n+\n+public abstract class MaskField<R extends ConnectRecord<R>> implements Transformation<R> {\n+\n+    public static final String OVERVIEW_DOC =\n+            \"Mask specified fields with a valid null value for the field type (i.e. 0, false, empty string, and so on).\"\n+                    + \"<p/>Use the concrete transformation type designed for the record key (<code>\" + Key.class.getCanonicalName() + \"</code>) \"\n+                    + \"or value (<code>\" + Value.class.getCanonicalName() + \"</code>).\";\n+\n+    private static final String FIELDS_CONFIG = \"fields\";\n+\n+    public static final ConfigDef CONFIG_DEF = new ConfigDef()\n+            .define(FIELDS_CONFIG, ConfigDef.Type.LIST, \"\", ConfigDef.Importance.HIGH, \"Names of fields to mask.\");\n+\n+    private static final String PURPOSE = \"mask fields\";\n+\n+    private static final Map<String, Object> PRIMITIVE_VALUE_MAPPING = new HashMap<>();\n+\n+    static {\n+        PRIMITIVE_VALUE_MAPPING.put(Boolean.class.getCanonicalName(), Boolean.FALSE);\n+        PRIMITIVE_VALUE_MAPPING.put(Byte.class.getCanonicalName(), (byte) 0);\n+        PRIMITIVE_VALUE_MAPPING.put(Short.class.getCanonicalName(), (short) 0);\n+        PRIMITIVE_VALUE_MAPPING.put(Integer.class.getCanonicalName(), 0);\n+        PRIMITIVE_VALUE_MAPPING.put(Long.class.getCanonicalName(), 0L);\n+        PRIMITIVE_VALUE_MAPPING.put(Float.class.getCanonicalName(), 0f);\n+        PRIMITIVE_VALUE_MAPPING.put(Double.class.getCanonicalName(), 0d);\n+        PRIMITIVE_VALUE_MAPPING.put(BigInteger.class.getCanonicalName(), BigInteger.ZERO);\n+        PRIMITIVE_VALUE_MAPPING.put(BigDecimal.class.getCanonicalName(), BigDecimal.ZERO);\n+        PRIMITIVE_VALUE_MAPPING.put(Date.class.getCanonicalName(), new Date(0));\n+        PRIMITIVE_VALUE_MAPPING.put(String.class.getCanonicalName(), \"\");","path":"connect/transforms/src/main/java/org/apache/kafka/connect/transforms/MaskField.java","position":null,"original_position":68,"commit_id":"be6739638b11d14adc7ac63b3f554e3527b56068","original_commit_id":"b4aa9ee2a60d5bcc66bc161c055d07e0795c163b","user":{"login":"ewencp","id":47366,"avatar_url":"https://avatars.githubusercontent.com/u/47366?v=3","gravatar_id":"","url":"https://api.github.com/users/ewencp","html_url":"https://github.com/ewencp","followers_url":"https://api.github.com/users/ewencp/followers","following_url":"https://api.github.com/users/ewencp/following{/other_user}","gists_url":"https://api.github.com/users/ewencp/gists{/gist_id}","starred_url":"https://api.github.com/users/ewencp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewencp/subscriptions","organizations_url":"https://api.github.com/users/ewencp/orgs","repos_url":"https://api.github.com/users/ewencp/repos","events_url":"https://api.github.com/users/ewencp/events{/privacy}","received_events_url":"https://api.github.com/users/ewencp/received_events","type":"User","site_admin":false},"body":"Not for the Java type `Byte`, I mean for the Connect `BYTES` schema type, i.e. `byte[].class`","created_at":"2017-01-20T01:47:32Z","updated_at":"2017-01-20T01:47:32Z","html_url":"https://github.com/apache/kafka/pull/2374#discussion_r96999048","pull_request_url":"https://api.github.com/repos/apache/kafka/pulls/2374","_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments/96999048"},"html":{"href":"https://github.com/apache/kafka/pull/2374#discussion_r96999048"},"pull_request":{"href":"https://api.github.com/repos/apache/kafka/pulls/2374"}}},"pull_request":{"url":"https://api.github.com/repos/apache/kafka/pulls/2374","id":101525175,"html_url":"https://github.com/apache/kafka/pull/2374","diff_url":"https://github.com/apache/kafka/pull/2374.diff","patch_url":"https://github.com/apache/kafka/pull/2374.patch","issue_url":"https://api.github.com/repos/apache/kafka/issues/2374","number":2374,"state":"open","locked":false,"title":"KAFKA-3209: KIP-66: more single message transforms","user":{"login":"shikhar","id":74267,"avatar_url":"https://avatars.githubusercontent.com/u/74267?v=3","gravatar_id":"","url":"https://api.github.com/users/shikhar","html_url":"https://github.com/shikhar","followers_url":"https://api.github.com/users/shikhar/followers","following_url":"https://api.github.com/users/shikhar/following{/other_user}","gists_url":"https://api.github.com/users/shikhar/gists{/gist_id}","starred_url":"https://api.github.com/users/shikhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shikhar/subscriptions","organizations_url":"https://api.github.com/users/shikhar/orgs","repos_url":"https://api.github.com/users/shikhar/repos","events_url":"https://api.github.com/users/shikhar/events{/privacy}","received_events_url":"https://api.github.com/users/shikhar/received_events","type":"User","site_admin":false},"body":"Renames `HoistToStruct` SMT to `HoistField`.\r\n\r\nAdds the following SMTs:\r\n`ExtractField`\r\n`MaskField`\r\n`RegexRouter`\r\n`ReplaceField`\r\n`SetSchemaMetadata`\r\n`ValueToKey`\r\n\r\nAdds HTML doc generation and updates to `connect.html`.","created_at":"2017-01-13T22:03:16Z","updated_at":"2017-01-20T01:47:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a67975a57cb304422e0899d8911754cd5e496c62","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/kafka/pulls/2374/commits","review_comments_url":"https://api.github.com/repos/apache/kafka/pulls/2374/comments","review_comment_url":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/kafka/issues/2374/comments","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/be6739638b11d14adc7ac63b3f554e3527b56068","head":{"label":"shikhar:more-smt","ref":"more-smt","sha":"be6739638b11d14adc7ac63b3f554e3527b56068","user":{"login":"shikhar","id":74267,"avatar_url":"https://avatars.githubusercontent.com/u/74267?v=3","gravatar_id":"","url":"https://api.github.com/users/shikhar","html_url":"https://github.com/shikhar","followers_url":"https://api.github.com/users/shikhar/followers","following_url":"https://api.github.com/users/shikhar/following{/other_user}","gists_url":"https://api.github.com/users/shikhar/gists{/gist_id}","starred_url":"https://api.github.com/users/shikhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shikhar/subscriptions","organizations_url":"https://api.github.com/users/shikhar/orgs","repos_url":"https://api.github.com/users/shikhar/repos","events_url":"https://api.github.com/users/shikhar/events{/privacy}","received_events_url":"https://api.github.com/users/shikhar/received_events","type":"User","site_admin":false},"repo":{"id":59165469,"name":"kafka","full_name":"shikhar/kafka","owner":{"login":"shikhar","id":74267,"avatar_url":"https://avatars.githubusercontent.com/u/74267?v=3","gravatar_id":"","url":"https://api.github.com/users/shikhar","html_url":"https://github.com/shikhar","followers_url":"https://api.github.com/users/shikhar/followers","following_url":"https://api.github.com/users/shikhar/following{/other_user}","gists_url":"https://api.github.com/users/shikhar/gists{/gist_id}","starred_url":"https://api.github.com/users/shikhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shikhar/subscriptions","organizations_url":"https://api.github.com/users/shikhar/orgs","repos_url":"https://api.github.com/users/shikhar/repos","events_url":"https://api.github.com/users/shikhar/events{/privacy}","received_events_url":"https://api.github.com/users/shikhar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shikhar/kafka","description":"Mirror of Apache Kafka","fork":true,"url":"https://api.github.com/repos/shikhar/kafka","forks_url":"https://api.github.com/repos/shikhar/kafka/forks","keys_url":"https://api.github.com/repos/shikhar/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shikhar/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shikhar/kafka/teams","hooks_url":"https://api.github.com/repos/shikhar/kafka/hooks","issue_events_url":"https://api.github.com/repos/shikhar/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/shikhar/kafka/events","assignees_url":"https://api.github.com/repos/shikhar/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/shikhar/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/shikhar/kafka/tags","blobs_url":"https://api.github.com/repos/shikhar/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shikhar/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shikhar/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/shikhar/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shikhar/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/shikhar/kafka/languages","stargazers_url":"https://api.github.com/repos/shikhar/kafka/stargazers","contributors_url":"https://api.github.com/repos/shikhar/kafka/contributors","subscribers_url":"https://api.github.com/repos/shikhar/kafka/subscribers","subscription_url":"https://api.github.com/repos/shikhar/kafka/subscription","commits_url":"https://api.github.com/repos/shikhar/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/shikhar/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/shikhar/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/shikhar/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/shikhar/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/shikhar/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shikhar/kafka/merges","archive_url":"https://api.github.com/repos/shikhar/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shikhar/kafka/downloads","issues_url":"https://api.github.com/repos/shikhar/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/shikhar/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/shikhar/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/shikhar/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shikhar/kafka/labels{/name}","releases_url":"https://api.github.com/repos/shikhar/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/shikhar/kafka/deployments","created_at":"2016-05-19T01:58:21Z","updated_at":"2016-05-19T01:58:25Z","pushed_at":"2017-01-20T00:02:57Z","git_url":"git://github.com/shikhar/kafka.git","ssh_url":"git@github.com:shikhar/kafka.git","clone_url":"https://github.com/shikhar/kafka.git","svn_url":"https://github.com/shikhar/kafka","homepage":null,"size":38892,"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":"trunk"}},"base":{"label":"apache:trunk","ref":"trunk","sha":"88fdca26a0881d12e9f3ba942cd580c8e8154025","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":2211243,"name":"kafka","full_name":"apache/kafka","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/kafka","description":"Mirror of Apache Kafka","fork":false,"url":"https://api.github.com/repos/apache/kafka","forks_url":"https://api.github.com/repos/apache/kafka/forks","keys_url":"https://api.github.com/repos/apache/kafka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/kafka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/kafka/teams","hooks_url":"https://api.github.com/repos/apache/kafka/hooks","issue_events_url":"https://api.github.com/repos/apache/kafka/issues/events{/number}","events_url":"https://api.github.com/repos/apache/kafka/events","assignees_url":"https://api.github.com/repos/apache/kafka/assignees{/user}","branches_url":"https://api.github.com/repos/apache/kafka/branches{/branch}","tags_url":"https://api.github.com/repos/apache/kafka/tags","blobs_url":"https://api.github.com/repos/apache/kafka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/kafka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/kafka/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/kafka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/kafka/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/kafka/languages","stargazers_url":"https://api.github.com/repos/apache/kafka/stargazers","contributors_url":"https://api.github.com/repos/apache/kafka/contributors","subscribers_url":"https://api.github.com/repos/apache/kafka/subscribers","subscription_url":"https://api.github.com/repos/apache/kafka/subscription","commits_url":"https://api.github.com/repos/apache/kafka/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/kafka/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/kafka/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/kafka/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/kafka/contents/{+path}","compare_url":"https://api.github.com/repos/apache/kafka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/kafka/merges","archive_url":"https://api.github.com/repos/apache/kafka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/kafka/downloads","issues_url":"https://api.github.com/repos/apache/kafka/issues{/number}","pulls_url":"https://api.github.com/repos/apache/kafka/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/kafka/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/kafka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/kafka/labels{/name}","releases_url":"https://api.github.com/repos/apache/kafka/releases{/id}","deployments_url":"https://api.github.com/repos/apache/kafka/deployments","created_at":"2011-08-15T18:06:16Z","updated_at":"2017-01-19T18:43:30Z","pushed_at":"2017-01-20T01:47:23Z","git_url":"git://github.com/apache/kafka.git","ssh_url":"git@github.com:apache/kafka.git","clone_url":"https://github.com/apache/kafka.git","svn_url":"https://github.com/apache/kafka","homepage":null,"size":39705,"stargazers_count":4460,"watchers_count":4460,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2772,"mirror_url":"git://git.apache.org/kafka.git","open_issues_count":275,"forks":2772,"open_issues":275,"watchers":4460,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/kafka/pulls/2374"},"html":{"href":"https://github.com/apache/kafka/pull/2374"},"issue":{"href":"https://api.github.com/repos/apache/kafka/issues/2374"},"comments":{"href":"https://api.github.com/repos/apache/kafka/issues/2374/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/kafka/pulls/2374/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/kafka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/kafka/pulls/2374/commits"},"statuses":{"href":"https://api.github.com/repos/apache/kafka/statuses/be6739638b11d14adc7ac63b3f554e3527b56068"}}}}
{"actor":{"display_login":"ewencp"}}