Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-10958

Add overload support for user defined function

    XMLWordPrintableJSON

    Details

      Description

      Currently overload is not supported in user defined function and given the following UDF

      class Func21 extends ScalarFunction {
        def eval(p: People): String = {
          p.name
        }
      
        def eval(p: Student): String = {
          "student#" + p.name
        }
      }
      
      class People(val name: String)
      
      class Student(name: String) extends People(name)
      
      class GraduatedStudent(name: String) extends Student(name)
      

      Queries such as the following will compile failed with error msg "Found multiple 'eval' methods which match the signature."

       

      val udf = new Func21
      val table = ...
      table.select(udf(new GraduatedStudent("test"))) 

      That's because overload is not supported in user defined function currently. I think it will make sense to support overload following the java language specification in section 15.2.

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dian.fu Dian Fu
                Reporter:
                dian.fu Dian Fu
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: