flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wuchong <...@git.apache.org>
Subject [GitHub] flink pull request #3389: [FLINK-5881] [table] ScalarFunction(UDF) should su...
Date Tue, 28 Feb 2017 02:51:54 GMT
Github user wuchong commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3389#discussion_r103361639
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/UserDefinedFunctionUtils.scala
---
    @@ -140,6 +138,24 @@ object UserDefinedFunctionUtils {
               s"one method named 'eval' which is public, not abstract and " +
               s"(in case of table functions) not static.")
         } else {
    +      var trailingSeq = false
    +      var noVargs = true
    +      methods.foreach(method => {
    +        val signatures = method.getParameterTypes
    +        if (signatures.nonEmpty) {
    +          if (method.isVarArgs) {
    +            noVargs = false
    +          } else if (signatures.last.getName.equals("scala.collection.Seq")) {
    +            trailingSeq = true
    +          }
    +        }
    +      })
    +      if (trailingSeq && noVargs) {
    +        // We found trailing "scala.collection.Seq", but no trailing "Type[]", "Type..."
    +        throw new ValidationException("The 'eval' method do not support Scala type of
" +
    --- End diff --
    
    If there is multiple eval methods found (not ambiguous), one is varargs, the other is
not. It seems that no exception is thrown to tell users that the non-varargs eval method is
not work.
    
    ```
    @varargs
    def eval(args: String*): String = {...}
    // no varargs annotation
    def eval(args: Int*): Int = {...}
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message