[jira] [Created] (FLINK-16726) ScalarFunction throws Given parameters of function 'func' do not match any signature.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-16726) ScalarFunction throws Given parameters of function 'func' do not match any signature.

Shang Yuanchun (Jira)
Matrix42 created FLINK-16726:
--------------------------------

             Summary: ScalarFunction throws Given parameters of function 'func' do not match any signature.
                 Key: FLINK-16726
                 URL: https://issues.apache.org/jira/browse/FLINK-16726
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 1.10.0
         Environment: [^Flinktest.zip]
            Reporter: Matrix42
         Attachments: Flinktest.zip

I write a ScalarFunction as follow:

 
{code:java}
public class UDF3 extends ScalarFunction {

    public String eval(String s, int a, double d) {
        return s + a + d;
    }

    @Override
    public boolean isDeterministic() {
        return true;
    }

    @Override
    public TypeInformation<?> getResultType(Class<?>[] signature) {
        return Types.STRING;
    }

    @Override
    public TypeInformation<?>[] getParameterTypes(Class<?>[] signature) {
        return new TypeInformation[]{Types.STRING, Types.INT, Types.DOUBLE};
    }
   
}
{code}
I use it in sql `select func(s, 1,2.2) from source`, Flink throw exception as follow:

 

 
{noformat}
Exception in thread "main" org.apache.flink.table.api.ValidationException: SQL validation failed. Given parameters of function 'func' do not match any signature. Exception in thread "main" org.apache.flink.table.api.ValidationException: SQL validation failed. Given parameters of function 'func' do not match any signature. Actual: (java.lang.String, java.lang.Integer, java.math.BigDecimal) Expected: (java.lang.String, int, double) at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.org$apache$flink$table$planner$calcite$FlinkPlannerImpl$$validate(FlinkPlannerImpl.scala:129) at org.apache.flink.table.planner.calcite.FlinkPlannerImpl.validate(FlinkPlannerImpl.scala:104) at org.apache.flink.table.planner.operations.SqlToOperationConverter.convert(SqlToOperationConverter.java:127) at org.apache.flink.table.planner.delegation.ParserImpl.parse(ParserImpl.java:85) at org.apache.flink.table.api.internal.TableEnvironmentImpl.sqlQuery(TableEnvironmentImpl.java:464) at com.lorinda.template.TestUDF3.main(TestUDF3.java:40){noformat}
 

the full code is in the [^Flinktest.zip] , class name is com.lorinda.template.TestUDF3

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)