Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.3.0
    • None
    • Table SQL / API
    • None

    Description

      When we define UDTF as follows:

      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))
        }
      }
      

      TableAPI:

       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)
      

      We will get the error as following:

      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)
      

      The reason is in `parameterTypeEquals` method, logical as follows:

      candidate == classOf[Date] && (expected == classOf[Int] || expected == classOf[JInt]) 
      

      I think we can modify the logical of `parameterTypeEquals` method.
      What do you think? Welcome anybody feedback...

      Attachments

        Issue Links

          Activity

            People

              sunjincheng121 sunjincheng
              sunjincheng121 sunjincheng
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: