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:

    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/ScalarSqlFunction.scala
    @@ -114,7 +114,9 @@ object ScalarSqlFunction {
             inferredTypes.zipWithIndex.foreach {
               case (inferredType, i) =>
    -            operandTypes(i) = inferredType
    +            if (operandTypes.length > 0) {
    +              operandTypes(i) = inferredType
    --- End diff --
    If this is a varargs method, the inferredType is an array type. The operand type should
be the component type of the array type, not the array type. 
    And the `operandTypes.length > 0` condition is still not safe, say the method is `eval(String
a, int... b)`  and calling `eval("hello")`, the `operandTypes`'s length is 1, but `inferredTypes`'s
length is 2. An IndexOutOfBoundsException would be thrown as before.

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.

View raw message