{"action":"created","comment":{"url":"https://api.github.com/repos/apache/flink/pulls/comments/123947651","pull_request_review_id":46191390,"id":123947651,"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+package org.apache.flink.table.runtime.functions\n+\n+import scala.annotation.varargs\n+import java.math.{BigDecimal => JBigDecimal}\n+import java.lang.{StringBuffer => JStringBuffer}\n+\n+/**\n+  * All build-in scalar scalar functions.\n+  */\n+class ScalarFunctions {}\n+\n+object ScalarFunctions {\n+\n+  def power(a: Double, b: JBigDecimal): Double = {\n+    Math.pow(a, b.doubleValue())\n+  }\n+\n+  /**\n+    * Returns the string that results from concatenating the arguments.\n+    * Returns NULL if any argument is NULL.\n+    */\n+  @varargs\n+  def concat(args: String*): String = {\n+    val sb = new JStringBuffer\n+    var i = 0\n+    while (i < args.length) {\n+      if (args(i) == null) {\n+        return null\n+      }\n+      sb.append(args(i))\n+      i += 1\n+    }\n+    sb.toString\n+  }\n+\n+  /**\n+    * Returns the string that results from concatenating the arguments and separator.\n+    * Returns NULL If the separator is NULL.\n+    *\n+    * Note: CONCAT_WS() does not skip empty strings. However, it does skip any NULL values after\n+    * the separator argument.\n+    *\n+    * @param args The first element of argument is the separator for the rest of the arguments.\n+    */\n+  @varargs\n+  def concat_ws(args: String*): String = {\n+    val separator = args(0)\n+    if (null == separator) {\n+      return null\n+    }\n+\n+    val sb = new JStringBuffer\n+\n+    var i = 1\n+    val dataList = args.filter(null != _)","path":"flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala","position":72,"original_position":72,"commit_id":"ba321bbfd5fea8632caf8b4d45d8a418f4df70ba","original_commit_id":"ba321bbfd5fea8632caf8b4d45d8a418f4df70ba","user":{"login":"twalthr","id":5746567,"avatar_url":"https://avatars2.githubusercontent.com/u/5746567?v=3","gravatar_id":"","url":"https://api.github.com/users/twalthr","html_url":"https://github.com/twalthr","followers_url":"https://api.github.com/users/twalthr/followers","following_url":"https://api.github.com/users/twalthr/following{/other_user}","gists_url":"https://api.github.com/users/twalthr/gists{/gist_id}","starred_url":"https://api.github.com/users/twalthr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twalthr/subscriptions","organizations_url":"https://api.github.com/users/twalthr/orgs","repos_url":"https://api.github.com/users/twalthr/repos","events_url":"https://api.github.com/users/twalthr/events{/privacy}","received_events_url":"https://api.github.com/users/twalthr/received_events","type":"User","site_admin":false},"body":"Why not doing the filtering within the while loop? You are iterating over the data twice. We should not use fancy Scala functions within runtime code.","created_at":"2017-06-26T07:59:09Z","updated_at":"2017-06-26T07:59:43Z","html_url":"https://github.com/apache/flink/pull/4138#discussion_r123947651","pull_request_url":"https://api.github.com/repos/apache/flink/pulls/4138","_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/comments/123947651"},"html":{"href":"https://github.com/apache/flink/pull/4138#discussion_r123947651"},"pull_request":{"href":"https://api.github.com/repos/apache/flink/pulls/4138"}}},"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/4138","id":126241353,"html_url":"https://github.com/apache/flink/pull/4138","diff_url":"https://github.com/apache/flink/pull/4138.diff","patch_url":"https://github.com/apache/flink/pull/4138.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/4138","number":4138,"state":"open","locked":false,"title":"[FLINK-6925][table]Add CONCAT/CONCAT_WS supported in SQL","user":{"login":"sunjincheng121","id":22488084,"avatar_url":"https://avatars3.githubusercontent.com/u/22488084?v=3","gravatar_id":"","url":"https://api.github.com/users/sunjincheng121","html_url":"https://github.com/sunjincheng121","followers_url":"https://api.github.com/users/sunjincheng121/followers","following_url":"https://api.github.com/users/sunjincheng121/following{/other_user}","gists_url":"https://api.github.com/users/sunjincheng121/gists{/gist_id}","starred_url":"https://api.github.com/users/sunjincheng121/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunjincheng121/subscriptions","organizations_url":"https://api.github.com/users/sunjincheng121/orgs","repos_url":"https://api.github.com/users/sunjincheng121/repos","events_url":"https://api.github.com/users/sunjincheng121/events{/privacy}","received_events_url":"https://api.github.com/users/sunjincheng121/received_events","type":"User","site_admin":false},"body":"In this PR. I have add CONCAT/CONCAT_WS supported in SQL.\r\n\r\n- [x] General\r\n  - The pull request references the related JIRA issue (\"[FLINK-6925][table]Add CONCAT/CONCAT_WS supported in SQL\")\r\n  - The pull request addresses only one issue\r\n  - Each commit in the PR has a meaningful commit message (including the JIRA id)\r\n\r\n- [ ] Documentation\r\n  - Documentation has been added for new functionality\r\n  - Old documentation affected by the pull request has been updated\r\n  - JavaDoc for public methods has been added\r\n\r\n- [x] Tests & Build\r\n  - Functionality added by the pull request is covered by tests\r\n  - `mvn clean verify` has been executed successfully locally or a Travis build has passed\r\n","created_at":"2017-06-19T07:45:24Z","updated_at":"2017-06-26T07:59:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1934910d4da8eebb52376e687d9daea8587b8431","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/4138/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/4138/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/4138/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/ba321bbfd5fea8632caf8b4d45d8a418f4df70ba","head":{"label":"sunjincheng121:FLINK-6925-PR","ref":"FLINK-6925-PR","sha":"ba321bbfd5fea8632caf8b4d45d8a418f4df70ba","user":{"login":"sunjincheng121","id":22488084,"avatar_url":"https://avatars3.githubusercontent.com/u/22488084?v=3","gravatar_id":"","url":"https://api.github.com/users/sunjincheng121","html_url":"https://github.com/sunjincheng121","followers_url":"https://api.github.com/users/sunjincheng121/followers","following_url":"https://api.github.com/users/sunjincheng121/following{/other_user}","gists_url":"https://api.github.com/users/sunjincheng121/gists{/gist_id}","starred_url":"https://api.github.com/users/sunjincheng121/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunjincheng121/subscriptions","organizations_url":"https://api.github.com/users/sunjincheng121/orgs","repos_url":"https://api.github.com/users/sunjincheng121/repos","events_url":"https://api.github.com/users/sunjincheng121/events{/privacy}","received_events_url":"https://api.github.com/users/sunjincheng121/received_events","type":"User","site_admin":false},"repo":{"id":70389886,"name":"flink","full_name":"sunjincheng121/flink","owner":{"login":"sunjincheng121","id":22488084,"avatar_url":"https://avatars3.githubusercontent.com/u/22488084?v=3","gravatar_id":"","url":"https://api.github.com/users/sunjincheng121","html_url":"https://github.com/sunjincheng121","followers_url":"https://api.github.com/users/sunjincheng121/followers","following_url":"https://api.github.com/users/sunjincheng121/following{/other_user}","gists_url":"https://api.github.com/users/sunjincheng121/gists{/gist_id}","starred_url":"https://api.github.com/users/sunjincheng121/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunjincheng121/subscriptions","organizations_url":"https://api.github.com/users/sunjincheng121/orgs","repos_url":"https://api.github.com/users/sunjincheng121/repos","events_url":"https://api.github.com/users/sunjincheng121/events{/privacy}","received_events_url":"https://api.github.com/users/sunjincheng121/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sunjincheng121/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/sunjincheng121/flink","forks_url":"https://api.github.com/repos/sunjincheng121/flink/forks","keys_url":"https://api.github.com/repos/sunjincheng121/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sunjincheng121/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sunjincheng121/flink/teams","hooks_url":"https://api.github.com/repos/sunjincheng121/flink/hooks","issue_events_url":"https://api.github.com/repos/sunjincheng121/flink/issues/events{/number}","events_url":"https://api.github.com/repos/sunjincheng121/flink/events","assignees_url":"https://api.github.com/repos/sunjincheng121/flink/assignees{/user}","branches_url":"https://api.github.com/repos/sunjincheng121/flink/branches{/branch}","tags_url":"https://api.github.com/repos/sunjincheng121/flink/tags","blobs_url":"https://api.github.com/repos/sunjincheng121/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sunjincheng121/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sunjincheng121/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/sunjincheng121/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sunjincheng121/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/sunjincheng121/flink/languages","stargazers_url":"https://api.github.com/repos/sunjincheng121/flink/stargazers","contributors_url":"https://api.github.com/repos/sunjincheng121/flink/contributors","subscribers_url":"https://api.github.com/repos/sunjincheng121/flink/subscribers","subscription_url":"https://api.github.com/repos/sunjincheng121/flink/subscription","commits_url":"https://api.github.com/repos/sunjincheng121/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/sunjincheng121/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/sunjincheng121/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/sunjincheng121/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/sunjincheng121/flink/contents/{+path}","compare_url":"https://api.github.com/repos/sunjincheng121/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sunjincheng121/flink/merges","archive_url":"https://api.github.com/repos/sunjincheng121/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sunjincheng121/flink/downloads","issues_url":"https://api.github.com/repos/sunjincheng121/flink/issues{/number}","pulls_url":"https://api.github.com/repos/sunjincheng121/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/sunjincheng121/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/sunjincheng121/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sunjincheng121/flink/labels{/name}","releases_url":"https://api.github.com/repos/sunjincheng121/flink/releases{/id}","deployments_url":"https://api.github.com/repos/sunjincheng121/flink/deployments","created_at":"2016-10-09T08:43:40Z","updated_at":"2016-10-09T08:44:02Z","pushed_at":"2017-06-26T07:36:26Z","git_url":"git://github.com/sunjincheng121/flink.git","ssh_url":"git@github.com:sunjincheng121/flink.git","clone_url":"https://github.com/sunjincheng121/flink.git","svn_url":"https://github.com/sunjincheng121/flink","homepage":null,"size":124421,"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,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"524a1fa0fecbcbd14d3cb6b9e99d20f424d58004","user":{"login":"apache","id":47359,"avatar_url":"https://avatars3.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":20587599,"name":"flink","full_name":"apache/flink","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars3.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/flink","description":"Mirror of Apache Flink","fork":false,"url":"https://api.github.com/repos/apache/flink","forks_url":"https://api.github.com/repos/apache/flink/forks","keys_url":"https://api.github.com/repos/apache/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/flink/teams","hooks_url":"https://api.github.com/repos/apache/flink/hooks","issue_events_url":"https://api.github.com/repos/apache/flink/issues/events{/number}","events_url":"https://api.github.com/repos/apache/flink/events","assignees_url":"https://api.github.com/repos/apache/flink/assignees{/user}","branches_url":"https://api.github.com/repos/apache/flink/branches{/branch}","tags_url":"https://api.github.com/repos/apache/flink/tags","blobs_url":"https://api.github.com/repos/apache/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/flink/languages","stargazers_url":"https://api.github.com/repos/apache/flink/stargazers","contributors_url":"https://api.github.com/repos/apache/flink/contributors","subscribers_url":"https://api.github.com/repos/apache/flink/subscribers","subscription_url":"https://api.github.com/repos/apache/flink/subscription","commits_url":"https://api.github.com/repos/apache/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/flink/contents/{+path}","compare_url":"https://api.github.com/repos/apache/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/flink/merges","archive_url":"https://api.github.com/repos/apache/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/flink/downloads","issues_url":"https://api.github.com/repos/apache/flink/issues{/number}","pulls_url":"https://api.github.com/repos/apache/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/flink/labels{/name}","releases_url":"https://api.github.com/repos/apache/flink/releases{/id}","deployments_url":"https://api.github.com/repos/apache/flink/deployments","created_at":"2014-06-07T07:00:10Z","updated_at":"2017-06-26T03:55:08Z","pushed_at":"2017-06-26T07:36:27Z","git_url":"git://github.com/apache/flink.git","ssh_url":"git@github.com:apache/flink.git","clone_url":"https://github.com/apache/flink.git","svn_url":"https://github.com/apache/flink","homepage":null,"size":126256,"stargazers_count":2442,"watchers_count":2442,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1712,"mirror_url":"git://git.apache.org/flink.git","open_issues_count":254,"forks":1712,"open_issues":254,"watchers":2442,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/4138"},"html":{"href":"https://github.com/apache/flink/pull/4138"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/4138"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/4138/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/4138/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/4138/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/ba321bbfd5fea8632caf8b4d45d8a418f4df70ba"}}}}
{"actor":{"display_login":"twalthr"}}