{"action":"created","comment":{"url":"https://api.github.com/repos/apache/phoenix/pulls/comments/173839154","pull_request_review_id":103093929,"id":173839154,"diff_hunk":"@@ -0,0 +1,79 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of 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,\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.phoenix.expression.function;\n+\n+import java.util.List;\n+\n+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;\n+import org.apache.phoenix.expression.Expression;\n+import org.apache.phoenix.parse.FunctionParseNode;\n+import org.apache.phoenix.schema.SortOrder;\n+import org.apache.phoenix.schema.TypeMismatchException;\n+import org.apache.phoenix.schema.types.PArrayDataTypeDecoder;\n+import org.apache.phoenix.schema.types.PArrayDataTypeEncoder;\n+import org.apache.phoenix.schema.types.PBinaryArray;\n+import org.apache.phoenix.schema.types.PDataType;\n+import org.apache.phoenix.schema.types.PVarbinary;\n+import org.apache.phoenix.schema.types.PVarbinaryArray;\n+\n+@FunctionParseNode.BuiltInFunction(name = ArrayRemoveFunction.NAME, args = {\n+\t\t@FunctionParseNode.Argument(allowedTypes = { PBinaryArray.class, PVarbinaryArray.class }),\n+\t\t@FunctionParseNode.Argument(allowedTypes = { PVarbinary.class }, defaultValue = \"null\") })\n+public class ArrayRemoveFunction extends ArrayModifierFunction {\n+\n+\tpublic static final String NAME = \"ARRAY_REMOVE\";\n+\n+\tpublic ArrayRemoveFunction() {\n+\t}\n+\n+\tpublic ArrayRemoveFunction(List<Expression> children) throws TypeMismatchException {\n+\t\tsuper(children);\n+\t}\n+\n+\t@Override\n+\tprotected boolean modifierFunction(ImmutableBytesWritable ptr, int length, int offset, byte[] arrayBytes,\n+\t\t\tPDataType baseType, int arrayLength, Integer maxLength, Expression arrayExp) {\n+\t\tSortOrder sortOrder = arrayExp.getSortOrder();\n+\n+\t\tif (ptr.getLength() == 0 || arrayBytes.length == 0) {\n+\t\t\tptr.set(arrayBytes, offset, length);\n+\t\t\treturn true;\n+\t\t}\n+\n+\t\tPArrayDataTypeEncoder arrayDataTypeEncoder = new PArrayDataTypeEncoder(baseType, sortOrder);\n+\n+\t\tfor (int arrayIndex = 0; arrayIndex < arrayLength; arrayIndex++) {\n+\t\t\tImmutableBytesWritable ptr2 = new ImmutableBytesWritable(arrayBytes, offset, length);\n+\t\t\tPArrayDataTypeDecoder.positionAtArrayElement(ptr2, arrayIndex, baseType, maxLength);\n+\t\t\tif (baseType.compareTo(ptr2, sortOrder, ptr, sortOrder, baseType) != 0) {","path":"phoenix-core/src/main/java/org/apache/phoenix/expression/function/ArrayRemoveFunction.java","position":65,"original_position":64,"commit_id":"ed134c1213f5359479c282b5f32cc50e20c53ee2","original_commit_id":"1b853807cddb2e8f9377f5c971a599820e925560","user":{"login":"xjodoin","id":235402,"avatar_url":"https://avatars0.githubusercontent.com/u/235402?v=4","gravatar_id":"","url":"https://api.github.com/users/xjodoin","html_url":"https://github.com/xjodoin","followers_url":"https://api.github.com/users/xjodoin/followers","following_url":"https://api.github.com/users/xjodoin/following{/other_user}","gists_url":"https://api.github.com/users/xjodoin/gists{/gist_id}","starred_url":"https://api.github.com/users/xjodoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xjodoin/subscriptions","organizations_url":"https://api.github.com/users/xjodoin/orgs","repos_url":"https://api.github.com/users/xjodoin/repos","events_url":"https://api.github.com/users/xjodoin/events{/privacy}","received_events_url":"https://api.github.com/users/xjodoin/received_events","type":"User","site_admin":false},"body":"it's works I added some tests to validate it","created_at":"2018-03-12T15:31:31Z","updated_at":"2018-03-12T15:31:32Z","html_url":"https://github.com/apache/phoenix/pull/294#discussion_r173839154","pull_request_url":"https://api.github.com/repos/apache/phoenix/pulls/294","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/apache/phoenix/pulls/comments/173839154"},"html":{"href":"https://github.com/apache/phoenix/pull/294#discussion_r173839154"},"pull_request":{"href":"https://api.github.com/repos/apache/phoenix/pulls/294"}},"in_reply_to_id":173612840},"pull_request":{"url":"https://api.github.com/repos/apache/phoenix/pulls/294","id":173199849,"html_url":"https://github.com/apache/phoenix/pull/294","diff_url":"https://github.com/apache/phoenix/pull/294.diff","patch_url":"https://github.com/apache/phoenix/pull/294.patch","issue_url":"https://api.github.com/repos/apache/phoenix/issues/294","number":294,"state":"open","locked":false,"title":"PHOENIX-4643 Implement ARRAY_REMOVE built in function","user":{"login":"xjodoin","id":235402,"avatar_url":"https://avatars0.githubusercontent.com/u/235402?v=4","gravatar_id":"","url":"https://api.github.com/users/xjodoin","html_url":"https://github.com/xjodoin","followers_url":"https://api.github.com/users/xjodoin/followers","following_url":"https://api.github.com/users/xjodoin/following{/other_user}","gists_url":"https://api.github.com/users/xjodoin/gists{/gist_id}","starred_url":"https://api.github.com/users/xjodoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xjodoin/subscriptions","organizations_url":"https://api.github.com/users/xjodoin/orgs","repos_url":"https://api.github.com/users/xjodoin/repos","events_url":"https://api.github.com/users/xjodoin/events{/privacy}","received_events_url":"https://api.github.com/users/xjodoin/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-06T15:54:15Z","updated_at":"2018-03-12T15:31:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42663fe3a7e8897472120fe2b00e27468ce6c25e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/phoenix/pulls/294/commits","review_comments_url":"https://api.github.com/repos/apache/phoenix/pulls/294/comments","review_comment_url":"https://api.github.com/repos/apache/phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/phoenix/issues/294/comments","statuses_url":"https://api.github.com/repos/apache/phoenix/statuses/ed134c1213f5359479c282b5f32cc50e20c53ee2","head":{"label":"xjodoin:PHOENIX-4643","ref":"PHOENIX-4643","sha":"ed134c1213f5359479c282b5f32cc50e20c53ee2","user":{"login":"xjodoin","id":235402,"avatar_url":"https://avatars0.githubusercontent.com/u/235402?v=4","gravatar_id":"","url":"https://api.github.com/users/xjodoin","html_url":"https://github.com/xjodoin","followers_url":"https://api.github.com/users/xjodoin/followers","following_url":"https://api.github.com/users/xjodoin/following{/other_user}","gists_url":"https://api.github.com/users/xjodoin/gists{/gist_id}","starred_url":"https://api.github.com/users/xjodoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xjodoin/subscriptions","organizations_url":"https://api.github.com/users/xjodoin/orgs","repos_url":"https://api.github.com/users/xjodoin/repos","events_url":"https://api.github.com/users/xjodoin/events{/privacy}","received_events_url":"https://api.github.com/users/xjodoin/received_events","type":"User","site_admin":false},"repo":{"id":124100862,"name":"phoenix","full_name":"xjodoin/phoenix","owner":{"login":"xjodoin","id":235402,"avatar_url":"https://avatars0.githubusercontent.com/u/235402?v=4","gravatar_id":"","url":"https://api.github.com/users/xjodoin","html_url":"https://github.com/xjodoin","followers_url":"https://api.github.com/users/xjodoin/followers","following_url":"https://api.github.com/users/xjodoin/following{/other_user}","gists_url":"https://api.github.com/users/xjodoin/gists{/gist_id}","starred_url":"https://api.github.com/users/xjodoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xjodoin/subscriptions","organizations_url":"https://api.github.com/users/xjodoin/orgs","repos_url":"https://api.github.com/users/xjodoin/repos","events_url":"https://api.github.com/users/xjodoin/events{/privacy}","received_events_url":"https://api.github.com/users/xjodoin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xjodoin/phoenix","description":"Mirror of Apache Phoenix","fork":true,"url":"https://api.github.com/repos/xjodoin/phoenix","forks_url":"https://api.github.com/repos/xjodoin/phoenix/forks","keys_url":"https://api.github.com/repos/xjodoin/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xjodoin/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xjodoin/phoenix/teams","hooks_url":"https://api.github.com/repos/xjodoin/phoenix/hooks","issue_events_url":"https://api.github.com/repos/xjodoin/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/xjodoin/phoenix/events","assignees_url":"https://api.github.com/repos/xjodoin/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/xjodoin/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/xjodoin/phoenix/tags","blobs_url":"https://api.github.com/repos/xjodoin/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xjodoin/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xjodoin/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/xjodoin/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xjodoin/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/xjodoin/phoenix/languages","stargazers_url":"https://api.github.com/repos/xjodoin/phoenix/stargazers","contributors_url":"https://api.github.com/repos/xjodoin/phoenix/contributors","subscribers_url":"https://api.github.com/repos/xjodoin/phoenix/subscribers","subscription_url":"https://api.github.com/repos/xjodoin/phoenix/subscription","commits_url":"https://api.github.com/repos/xjodoin/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/xjodoin/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/xjodoin/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/xjodoin/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/xjodoin/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/xjodoin/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xjodoin/phoenix/merges","archive_url":"https://api.github.com/repos/xjodoin/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xjodoin/phoenix/downloads","issues_url":"https://api.github.com/repos/xjodoin/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/xjodoin/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/xjodoin/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/xjodoin/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xjodoin/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/xjodoin/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/xjodoin/phoenix/deployments","created_at":"2018-03-06T15:47:07Z","updated_at":"2018-03-06T15:47:17Z","pushed_at":"2018-03-12T15:30:25Z","git_url":"git://github.com/xjodoin/phoenix.git","ssh_url":"git@github.com:xjodoin/phoenix.git","clone_url":"https://github.com/xjodoin/phoenix.git","svn_url":"https://github.com/xjodoin/phoenix","homepage":null,"size":41221,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"35a90e4e6ea46105983d60d845324abaf5028d99","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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":20473418,"name":"phoenix","full_name":"apache/phoenix","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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/phoenix","description":"Mirror of Apache Phoenix","fork":false,"url":"https://api.github.com/repos/apache/phoenix","forks_url":"https://api.github.com/repos/apache/phoenix/forks","keys_url":"https://api.github.com/repos/apache/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/phoenix/teams","hooks_url":"https://api.github.com/repos/apache/phoenix/hooks","issue_events_url":"https://api.github.com/repos/apache/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/apache/phoenix/events","assignees_url":"https://api.github.com/repos/apache/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/apache/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/apache/phoenix/tags","blobs_url":"https://api.github.com/repos/apache/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/phoenix/languages","stargazers_url":"https://api.github.com/repos/apache/phoenix/stargazers","contributors_url":"https://api.github.com/repos/apache/phoenix/contributors","subscribers_url":"https://api.github.com/repos/apache/phoenix/subscribers","subscription_url":"https://api.github.com/repos/apache/phoenix/subscription","commits_url":"https://api.github.com/repos/apache/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/apache/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/phoenix/merges","archive_url":"https://api.github.com/repos/apache/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/phoenix/downloads","issues_url":"https://api.github.com/repos/apache/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/apache/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/apache/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/apache/phoenix/deployments","created_at":"2014-06-04T07:00:08Z","updated_at":"2018-03-12T15:31:31Z","pushed_at":"2018-03-12T15:30:29Z","git_url":"git://github.com/apache/phoenix.git","ssh_url":"git@github.com:apache/phoenix.git","clone_url":"https://github.com/apache/phoenix.git","svn_url":"https://github.com/apache/phoenix","homepage":null,"size":41389,"stargazers_count":436,"watchers_count":436,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":567,"mirror_url":null,"archived":false,"open_issues_count":151,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":567,"open_issues":151,"watchers":436,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/phoenix/pulls/294"},"html":{"href":"https://github.com/apache/phoenix/pull/294"},"issue":{"href":"https://api.github.com/repos/apache/phoenix/issues/294"},"comments":{"href":"https://api.github.com/repos/apache/phoenix/issues/294/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/phoenix/pulls/294/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/phoenix/pulls/294/commits"},"statuses":{"href":"https://api.github.com/repos/apache/phoenix/statuses/ed134c1213f5359479c282b5f32cc50e20c53ee2"}},"author_association":"NONE"}}
{"actor":{"display_login":"xjodoin"}}