[ 
https://issues.apache.org/jira/browse/FLINK-6740?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

sunjincheng closed FLINK-6740.
------------------------------
    Resolution: Duplicate

> Fix "parameterTypeEquals" method error.
> ---------------------------------------
>
>                 Key: FLINK-6740
>                 URL: https://issues.apache.org/jira/browse/FLINK-6740
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>    Affects Versions: 1.3.0
>            Reporter: sunjincheng
>            Assignee: sunjincheng
>
> When we define UDTF as follows:
> {code}
> class TableFuncPojo extends TableFunction[TPojo] {
>   def eval(age: Int, name:String): Unit = {
>     collect(new TPojo(age.toLong,name))
>   }
>   def eval(age: Date, name:String): Unit = {
>      collect(new 
> TPojo(org.apache.calcite.runtime.SqlFunctions.toInt(age).toLong,name))
>   }
> }
> {code}
> TableAPI:
> {code}
>  val table = stream.toTable(tEnv,
>       'long2, 'int, 'double, 'float, 'bigdec, 'ts, 'date,'pojo, 'string, 
> 'long.rowtime)
>     val windowedTable = table
>       .join(udtf('date, 'string) as 'pojo2).select('pojo2)
> {code}
> We will get the error as following:
> {code}
> org.apache.flink.table.api.ValidationException: Found multiple 'eval' methods 
> which match the signature.
>       at 
> org.apache.flink.table.functions.utils.UserDefinedFunctionUtils$.getUserDefinedMethod(UserDefinedFunctionUtils.scala:180)
>       at 
> org.apache.flink.table.plan.logical.LogicalTableFunctionCall.validate(operators.scala:700)
>       at org.apache.flink.table.api.Table.join(table.scala:539)
>       at org.apache.flink.table.api.Table.join(table.scala:328)
>       at 
> org.apache.flink.table.runtime.datastream.DataStreamAggregateITCase.test1(DataStreamAggregateITCase.scala:84)
> {code}
> The reason is in `parameterTypeEquals` method, logical as follows:
> {code}
> candidate == classOf[Date] && (expected == classOf[Int] || expected == 
> classOf[JInt]) 
> {code}
> I think we can modify the logical of  `parameterTypeEquals` method.
> What do you think? Welcome anybody feedback...



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to