{"action":"created","comment":{"url":"https://api.github.com/repos/apache/drill/pulls/comments/227349104","pull_request_review_id":167345256,"id":227349104,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNzM0OTEwNA==","diff_hunk":"@@ -23,65 +23,157 @@\n import org.apache.drill.exec.expr.annotations.Output;\n import org.apache.drill.exec.expr.annotations.Param;\n import org.apache.drill.exec.expr.holders.NullableVarCharHolder;\n+import org.apache.drill.exec.expr.holders.VarCharHolder;\n import org.apache.drill.exec.vector.complex.writer.BaseWriter;\n \n import javax.inject.Inject;\n \n-@FunctionTemplate(\n-        name=\"parse_query\",\n-        scope= FunctionTemplate.FunctionScope.SIMPLE,\n-        nulls = FunctionTemplate.NullHandling.NULL_IF_NULL\n-)\n+/**\n+ * The function splits up a query string and returns a map of the key-value pairs.\n+ * For example, {@code parse_query('url?arg1=x&arg2=y')} will return:\n+ * <pre>\n+ * {\n+ *   \"arg1\": \"x\",\n+ *   \"arg2\": \"y\"\n+ * }\n+ * </pre>\n+ */\n+public class ParseQueryFunction {\n \n-public class ParseQueryFunction implements DrillSimpleFunc {\n+  @FunctionTemplate(name = \"parse_query\", scope = FunctionTemplate.FunctionScope.SIMPLE)\n+  public static class ParseQuery implements DrillSimpleFunc {\n \n     @Param\n-    NullableVarCharHolder input;\n-\n+    VarCharHolder in;\n     @Output\n     BaseWriter.ComplexWriter outWriter;\n-\n     @Inject\n     DrillBuf outBuffer;\n \n+    @Override\n     public void setup() {\n     }\n \n+    @Override\n     public void eval() {\n-\n-        org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter queryMapWriter = outWriter.rootAsMap();\n-\n-        String queryString = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start, input.end, input.buffer);\n-\n-        if( queryString.isEmpty() || queryString.equals(\"null\")){\n-            queryString = \"\";\n+      org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter mapWriter = outWriter.rootAsMap();\n+\n+      String queryString =\n+          org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(in.start, in.end, in.buffer);\n+      int questionMarkIndex = queryString.indexOf(\"?\");\n+      if (questionMarkIndex > -1) {\n+        // Leave query parameters only\n+        queryString = queryString.substring(questionMarkIndex + 1);\n+      }\n+\n+      if (queryString.trim().isEmpty() || queryString.equals(\"null\")) {","path":"exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ParseQueryFunction.java","position":63,"original_position":63,"commit_id":"fd043d0ecf410a57e248c605b3ce590ee206e189","original_commit_id":"fd043d0ecf410a57e248c605b3ce590ee206e189","user":{"login":"arina-ielchiieva","id":15086720,"node_id":"MDQ6VXNlcjE1MDg2NzIw","avatar_url":"https://avatars3.githubusercontent.com/u/15086720?v=4","gravatar_id":"","url":"https://api.github.com/users/arina-ielchiieva","html_url":"https://github.com/arina-ielchiieva","followers_url":"https://api.github.com/users/arina-ielchiieva/followers","following_url":"https://api.github.com/users/arina-ielchiieva/following{/other_user}","gists_url":"https://api.github.com/users/arina-ielchiieva/gists{/gist_id}","starred_url":"https://api.github.com/users/arina-ielchiieva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arina-ielchiieva/subscriptions","organizations_url":"https://api.github.com/users/arina-ielchiieva/orgs","repos_url":"https://api.github.com/users/arina-ielchiieva/repos","events_url":"https://api.github.com/users/arina-ielchiieva/events{/privacy}","received_events_url":"https://api.github.com/users/arina-ielchiieva/received_events","type":"User","site_admin":false},"body":"`equalsIgnoreCase`?","created_at":"2018-10-23T11:37:13Z","updated_at":"2018-10-23T11:56:51Z","html_url":"https://github.com/apache/drill/pull/1509#discussion_r227349104","pull_request_url":"https://api.github.com/repos/apache/drill/pulls/1509","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/drill/pulls/comments/227349104"},"html":{"href":"https://github.com/apache/drill/pull/1509#discussion_r227349104"},"pull_request":{"href":"https://api.github.com/repos/apache/drill/pulls/1509"}}},"pull_request":{"url":"https://api.github.com/repos/apache/drill/pulls/1509","id":224950095,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0OTUwMDk1","html_url":"https://github.com/apache/drill/pull/1509","diff_url":"https://github.com/apache/drill/pull/1509.diff","patch_url":"https://github.com/apache/drill/pull/1509.patch","issue_url":"https://api.github.com/repos/apache/drill/issues/1509","number":1509,"state":"open","locked":false,"title":"DRILL-6810: Disable NULL_IF_NULL NullHandling for functions with Comp…","user":{"login":"KazydubB","id":38408110,"node_id":"MDQ6VXNlcjM4NDA4MTEw","avatar_url":"https://avatars3.githubusercontent.com/u/38408110?v=4","gravatar_id":"","url":"https://api.github.com/users/KazydubB","html_url":"https://github.com/KazydubB","followers_url":"https://api.github.com/users/KazydubB/followers","following_url":"https://api.github.com/users/KazydubB/following{/other_user}","gists_url":"https://api.github.com/users/KazydubB/gists{/gist_id}","starred_url":"https://api.github.com/users/KazydubB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KazydubB/subscriptions","organizations_url":"https://api.github.com/users/KazydubB/orgs","repos_url":"https://api.github.com/users/KazydubB/repos","events_url":"https://api.github.com/users/KazydubB/events{/privacy}","received_events_url":"https://api.github.com/users/KazydubB/received_events","type":"User","site_admin":false},"body":"…lexWriter","created_at":"2018-10-23T08:51:40Z","updated_at":"2018-10-23T11:56:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab527b23071de7ea760aba7878a7ef1a5f6222d9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/drill/pulls/1509/commits","review_comments_url":"https://api.github.com/repos/apache/drill/pulls/1509/comments","review_comment_url":"https://api.github.com/repos/apache/drill/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/drill/issues/1509/comments","statuses_url":"https://api.github.com/repos/apache/drill/statuses/fd043d0ecf410a57e248c605b3ce590ee206e189","head":{"label":"KazydubB:DRILL-6810","ref":"DRILL-6810","sha":"fd043d0ecf410a57e248c605b3ce590ee206e189","user":{"login":"KazydubB","id":38408110,"node_id":"MDQ6VXNlcjM4NDA4MTEw","avatar_url":"https://avatars3.githubusercontent.com/u/38408110?v=4","gravatar_id":"","url":"https://api.github.com/users/KazydubB","html_url":"https://github.com/KazydubB","followers_url":"https://api.github.com/users/KazydubB/followers","following_url":"https://api.github.com/users/KazydubB/following{/other_user}","gists_url":"https://api.github.com/users/KazydubB/gists{/gist_id}","starred_url":"https://api.github.com/users/KazydubB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KazydubB/subscriptions","organizations_url":"https://api.github.com/users/KazydubB/orgs","repos_url":"https://api.github.com/users/KazydubB/repos","events_url":"https://api.github.com/users/KazydubB/events{/privacy}","received_events_url":"https://api.github.com/users/KazydubB/received_events","type":"User","site_admin":false},"repo":{"id":132113415,"node_id":"MDEwOlJlcG9zaXRvcnkxMzIxMTM0MTU=","name":"drill","full_name":"KazydubB/drill","private":false,"owner":{"login":"KazydubB","id":38408110,"node_id":"MDQ6VXNlcjM4NDA4MTEw","avatar_url":"https://avatars3.githubusercontent.com/u/38408110?v=4","gravatar_id":"","url":"https://api.github.com/users/KazydubB","html_url":"https://github.com/KazydubB","followers_url":"https://api.github.com/users/KazydubB/followers","following_url":"https://api.github.com/users/KazydubB/following{/other_user}","gists_url":"https://api.github.com/users/KazydubB/gists{/gist_id}","starred_url":"https://api.github.com/users/KazydubB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KazydubB/subscriptions","organizations_url":"https://api.github.com/users/KazydubB/orgs","repos_url":"https://api.github.com/users/KazydubB/repos","events_url":"https://api.github.com/users/KazydubB/events{/privacy}","received_events_url":"https://api.github.com/users/KazydubB/received_events","type":"User","site_admin":false},"html_url":"https://github.com/KazydubB/drill","description":"Apache Drill","fork":true,"url":"https://api.github.com/repos/KazydubB/drill","forks_url":"https://api.github.com/repos/KazydubB/drill/forks","keys_url":"https://api.github.com/repos/KazydubB/drill/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KazydubB/drill/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KazydubB/drill/teams","hooks_url":"https://api.github.com/repos/KazydubB/drill/hooks","issue_events_url":"https://api.github.com/repos/KazydubB/drill/issues/events{/number}","events_url":"https://api.github.com/repos/KazydubB/drill/events","assignees_url":"https://api.github.com/repos/KazydubB/drill/assignees{/user}","branches_url":"https://api.github.com/repos/KazydubB/drill/branches{/branch}","tags_url":"https://api.github.com/repos/KazydubB/drill/tags","blobs_url":"https://api.github.com/repos/KazydubB/drill/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KazydubB/drill/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KazydubB/drill/git/refs{/sha}","trees_url":"https://api.github.com/repos/KazydubB/drill/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KazydubB/drill/statuses/{sha}","languages_url":"https://api.github.com/repos/KazydubB/drill/languages","stargazers_url":"https://api.github.com/repos/KazydubB/drill/stargazers","contributors_url":"https://api.github.com/repos/KazydubB/drill/contributors","subscribers_url":"https://api.github.com/repos/KazydubB/drill/subscribers","subscription_url":"https://api.github.com/repos/KazydubB/drill/subscription","commits_url":"https://api.github.com/repos/KazydubB/drill/commits{/sha}","git_commits_url":"https://api.github.com/repos/KazydubB/drill/git/commits{/sha}","comments_url":"https://api.github.com/repos/KazydubB/drill/comments{/number}","issue_comment_url":"https://api.github.com/repos/KazydubB/drill/issues/comments{/number}","contents_url":"https://api.github.com/repos/KazydubB/drill/contents/{+path}","compare_url":"https://api.github.com/repos/KazydubB/drill/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KazydubB/drill/merges","archive_url":"https://api.github.com/repos/KazydubB/drill/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KazydubB/drill/downloads","issues_url":"https://api.github.com/repos/KazydubB/drill/issues{/number}","pulls_url":"https://api.github.com/repos/KazydubB/drill/pulls{/number}","milestones_url":"https://api.github.com/repos/KazydubB/drill/milestones{/number}","notifications_url":"https://api.github.com/repos/KazydubB/drill/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KazydubB/drill/labels{/name}","releases_url":"https://api.github.com/repos/KazydubB/drill/releases{/id}","deployments_url":"https://api.github.com/repos/KazydubB/drill/deployments","created_at":"2018-05-04T08:41:18Z","updated_at":"2018-10-23T08:48:16Z","pushed_at":"2018-10-23T08:49:04Z","git_url":"git://github.com/KazydubB/drill.git","ssh_url":"git@github.com:KazydubB/drill.git","clone_url":"https://github.com/KazydubB/drill.git","svn_url":"https://github.com/KazydubB/drill","homepage":"","size":64647,"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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"2882b89c2288a9df7c9abd5321cb85c588312b8c","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","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":5683653,"node_id":"MDEwOlJlcG9zaXRvcnk1NjgzNjUz","name":"drill","full_name":"apache/drill","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","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},"html_url":"https://github.com/apache/drill","description":"Apache Drill","fork":false,"url":"https://api.github.com/repos/apache/drill","forks_url":"https://api.github.com/repos/apache/drill/forks","keys_url":"https://api.github.com/repos/apache/drill/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/drill/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/drill/teams","hooks_url":"https://api.github.com/repos/apache/drill/hooks","issue_events_url":"https://api.github.com/repos/apache/drill/issues/events{/number}","events_url":"https://api.github.com/repos/apache/drill/events","assignees_url":"https://api.github.com/repos/apache/drill/assignees{/user}","branches_url":"https://api.github.com/repos/apache/drill/branches{/branch}","tags_url":"https://api.github.com/repos/apache/drill/tags","blobs_url":"https://api.github.com/repos/apache/drill/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/drill/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/drill/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/drill/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/drill/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/drill/languages","stargazers_url":"https://api.github.com/repos/apache/drill/stargazers","contributors_url":"https://api.github.com/repos/apache/drill/contributors","subscribers_url":"https://api.github.com/repos/apache/drill/subscribers","subscription_url":"https://api.github.com/repos/apache/drill/subscription","commits_url":"https://api.github.com/repos/apache/drill/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/drill/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/drill/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/drill/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/drill/contents/{+path}","compare_url":"https://api.github.com/repos/apache/drill/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/drill/merges","archive_url":"https://api.github.com/repos/apache/drill/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/drill/downloads","issues_url":"https://api.github.com/repos/apache/drill/issues{/number}","pulls_url":"https://api.github.com/repos/apache/drill/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/drill/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/drill/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/drill/labels{/name}","releases_url":"https://api.github.com/repos/apache/drill/releases{/id}","deployments_url":"https://api.github.com/repos/apache/drill/deployments","created_at":"2012-09-05T07:00:26Z","updated_at":"2018-10-22T14:01:24Z","pushed_at":"2018-10-23T09:14:32Z","git_url":"git://github.com/apache/drill.git","ssh_url":"git@github.com:apache/drill.git","clone_url":"https://github.com/apache/drill.git","svn_url":"https://github.com/apache/drill","homepage":"","size":65250,"stargazers_count":1048,"watchers_count":1048,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":700,"mirror_url":null,"archived":false,"open_issues_count":90,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":700,"open_issues":90,"watchers":1048,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/drill/pulls/1509"},"html":{"href":"https://github.com/apache/drill/pull/1509"},"issue":{"href":"https://api.github.com/repos/apache/drill/issues/1509"},"comments":{"href":"https://api.github.com/repos/apache/drill/issues/1509/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/drill/pulls/1509/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/drill/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/drill/pulls/1509/commits"},"statuses":{"href":"https://api.github.com/repos/apache/drill/statuses/fd043d0ecf410a57e248c605b3ce590ee206e189"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"arina-ielchiieva"}}