{"action":"created","comment":{"url":"https://api.github.com/repos/apache/flink/pulls/comments/158604394","pull_request_review_id":85443342,"id":158604394,"diff_hunk":"@@ -153,15 +154,19 @@ object ScalarSqlFunction {\n       override def getOperandCountRange: SqlOperandCountRange = {\n         var min = 255\n         var max = -1\n+        var isVarargs = false\n         signatures.foreach( sig => {\n-          var len = sig.length\n-          if (len > 0 && sig(sig.length - 1).isArray) {\n-            max = 254  // according to JVM spec 4.3.3\n-            len = sig.length - 1\n+          var len = sig._2.length\n+          if (len > 0 && sig._1 && sig._2(sig._2.length - 1).isArray) {\n+            isVarargs = true\n+            len = sig._2.length - 1","path":"flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/ScalarSqlFunction.scala","position":23,"original_position":23,"commit_id":"4de1200791193163e5ade21cdfb1160e3894342d","original_commit_id":"4de1200791193163e5ade21cdfb1160e3894342d","user":{"login":"sunjincheng121","id":22488084,"avatar_url":"https://avatars0.githubusercontent.com/u/22488084?v=4","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":"**approach 1：**\r\nsig._2.length - 1 => len -1 \r\nlen = sig._2.length - 1 => len-1\r\n\r\n**approach2**\r\nmethods.foreach(\r\n          m => {\r\n            var len = m.getParameterTypes.length\r\n            if (len > 0 && m.isVarArgs && m.getParameterTypes()(len - 1).isArray) {\r\n              isVarargs = true\r\n              len = len - 1\r\n            }\r\n            max = Math.max(len, max)\r\n            min = Math.min(len, min)\r\n          })\r\n\r\nUsing approach2 we can remove \r\n\"val signatures = methods.map(m => m.isVarArgs -> m.getParameterTypes)\"\r\n\r\nWhat do you think?\r\n","created_at":"2017-12-24T15:23:41Z","updated_at":"2017-12-24T15:25:09Z","html_url":"https://github.com/apache/flink/pull/5206#discussion_r158604394","pull_request_url":"https://api.github.com/repos/apache/flink/pulls/5206","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/comments/158604394"},"html":{"href":"https://github.com/apache/flink/pull/5206#discussion_r158604394"},"pull_request":{"href":"https://api.github.com/repos/apache/flink/pulls/5206"}}},"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/5206","id":159965143,"html_url":"https://github.com/apache/flink/pull/5206","diff_url":"https://github.com/apache/flink/pull/5206.diff","patch_url":"https://github.com/apache/flink/pull/5206.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/5206","number":5206,"state":"open","locked":false,"title":"[FLINK-8312][TableAPI && SQL] Fix ScalarFunction varargs length excee…","user":{"login":"Xpray","id":5170813,"avatar_url":"https://avatars0.githubusercontent.com/u/5170813?v=4","gravatar_id":"","url":"https://api.github.com/users/Xpray","html_url":"https://github.com/Xpray","followers_url":"https://api.github.com/users/Xpray/followers","following_url":"https://api.github.com/users/Xpray/following{/other_user}","gists_url":"https://api.github.com/users/Xpray/gists{/gist_id}","starred_url":"https://api.github.com/users/Xpray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xpray/subscriptions","organizations_url":"https://api.github.com/users/Xpray/orgs","repos_url":"https://api.github.com/users/Xpray/repos","events_url":"https://api.github.com/users/Xpray/events{/privacy}","received_events_url":"https://api.github.com/users/Xpray/received_events","type":"User","site_admin":false},"body":"\r\n\r\n## What is the purpose of the change\r\n\r\n*Support parameters exceeds 254 with Varargs for SQL*\r\n\r\n\r\n## Brief change log\r\n\r\n  - *if scalar function is varargs, do not check parameter length, set max length to -1*\r\n\r\n\r\n## Verifying this change\r\n\r\n\r\n\r\nThis change added tests and can be verified as follows:\r\n\r\n*(example:)*\r\n  - *SqlITCase.testUDFWithLongVarargs*\r\n\r\n\r\n## Does this pull request potentially affect one of the following parts:\r\n\r\n  - Dependencies (does it add or upgrade a dependency): no\r\n  - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no\r\n  - The serializers: no\r\n  - The runtime per-record code paths (performance sensitive): no\r\n  - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: no\r\n  - The S3 file system connector: no\r\n\r\n## Documentation\r\n\r\n  - Does this pull request introduce a new feature? no\r\n","created_at":"2017-12-23T10:57:20Z","updated_at":"2017-12-24T15:25:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"14e7bbc018b3125c9cdd0d962a7f77c707d3f4c8","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/5206/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/5206/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/5206/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/4de1200791193163e5ade21cdfb1160e3894342d","head":{"label":"Xpray:FLINK-8312","ref":"FLINK-8312","sha":"4de1200791193163e5ade21cdfb1160e3894342d","user":{"login":"Xpray","id":5170813,"avatar_url":"https://avatars0.githubusercontent.com/u/5170813?v=4","gravatar_id":"","url":"https://api.github.com/users/Xpray","html_url":"https://github.com/Xpray","followers_url":"https://api.github.com/users/Xpray/followers","following_url":"https://api.github.com/users/Xpray/following{/other_user}","gists_url":"https://api.github.com/users/Xpray/gists{/gist_id}","starred_url":"https://api.github.com/users/Xpray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xpray/subscriptions","organizations_url":"https://api.github.com/users/Xpray/orgs","repos_url":"https://api.github.com/users/Xpray/repos","events_url":"https://api.github.com/users/Xpray/events{/privacy}","received_events_url":"https://api.github.com/users/Xpray/received_events","type":"User","site_admin":false},"repo":{"id":88852580,"name":"flink","full_name":"Xpray/flink","owner":{"login":"Xpray","id":5170813,"avatar_url":"https://avatars0.githubusercontent.com/u/5170813?v=4","gravatar_id":"","url":"https://api.github.com/users/Xpray","html_url":"https://github.com/Xpray","followers_url":"https://api.github.com/users/Xpray/followers","following_url":"https://api.github.com/users/Xpray/following{/other_user}","gists_url":"https://api.github.com/users/Xpray/gists{/gist_id}","starred_url":"https://api.github.com/users/Xpray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xpray/subscriptions","organizations_url":"https://api.github.com/users/Xpray/orgs","repos_url":"https://api.github.com/users/Xpray/repos","events_url":"https://api.github.com/users/Xpray/events{/privacy}","received_events_url":"https://api.github.com/users/Xpray/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Xpray/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/Xpray/flink","forks_url":"https://api.github.com/repos/Xpray/flink/forks","keys_url":"https://api.github.com/repos/Xpray/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Xpray/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Xpray/flink/teams","hooks_url":"https://api.github.com/repos/Xpray/flink/hooks","issue_events_url":"https://api.github.com/repos/Xpray/flink/issues/events{/number}","events_url":"https://api.github.com/repos/Xpray/flink/events","assignees_url":"https://api.github.com/repos/Xpray/flink/assignees{/user}","branches_url":"https://api.github.com/repos/Xpray/flink/branches{/branch}","tags_url":"https://api.github.com/repos/Xpray/flink/tags","blobs_url":"https://api.github.com/repos/Xpray/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Xpray/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Xpray/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/Xpray/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Xpray/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/Xpray/flink/languages","stargazers_url":"https://api.github.com/repos/Xpray/flink/stargazers","contributors_url":"https://api.github.com/repos/Xpray/flink/contributors","subscribers_url":"https://api.github.com/repos/Xpray/flink/subscribers","subscription_url":"https://api.github.com/repos/Xpray/flink/subscription","commits_url":"https://api.github.com/repos/Xpray/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/Xpray/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/Xpray/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/Xpray/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/Xpray/flink/contents/{+path}","compare_url":"https://api.github.com/repos/Xpray/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Xpray/flink/merges","archive_url":"https://api.github.com/repos/Xpray/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Xpray/flink/downloads","issues_url":"https://api.github.com/repos/Xpray/flink/issues{/number}","pulls_url":"https://api.github.com/repos/Xpray/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/Xpray/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/Xpray/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Xpray/flink/labels{/name}","releases_url":"https://api.github.com/repos/Xpray/flink/releases{/id}","deployments_url":"https://api.github.com/repos/Xpray/flink/deployments","created_at":"2017-04-20T10:20:40Z","updated_at":"2017-04-20T10:21:06Z","pushed_at":"2017-12-24T12:58:03Z","git_url":"git://github.com/Xpray/flink.git","ssh_url":"git@github.com:Xpray/flink.git","clone_url":"https://github.com/Xpray/flink.git","svn_url":"https://github.com/Xpray/flink","homepage":null,"size":139819,"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":3,"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":3,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"15a0dc4aecea4a5cff26abef00a067577a27c985","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":20587599,"name":"flink","full_name":"apache/flink","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/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-12-24T10:59:32Z","pushed_at":"2017-12-24T12:58:08Z","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":141111,"stargazers_count":3086,"watchers_count":3086,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2098,"mirror_url":null,"archived":false,"open_issues_count":332,"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":2098,"open_issues":332,"watchers":3086,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/5206"},"html":{"href":"https://github.com/apache/flink/pull/5206"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/5206"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/5206/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/5206/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/5206/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/4de1200791193163e5ade21cdfb1160e3894342d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sunjincheng121"}}