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

add open and close methods for UserDefinedFunction in TableAPI & SQL

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • Table SQL / API
    • None

    Description

      Currently, a User Defined Function (UDF) in table API & SQL works on zero, one, or multiple values in custom evaluation method. Many UDFs need more complex features, e.g. report metrics, get parameters from job configuration, or get extra data from distribute cache file, etc. Adding open and close methods in UserDefinedFunction class can solve this problem. The code cloud look like:

      trait UserDefinedFunction {
      
        def open(context: UDFContext): Unit = {}
      
        def close(): Unit = {}
      }
      

      UDFContext contains the information about metric reporters, job parameters, distribute cache, etc. The code cloud look like:

      class UDFContext(context: RuntimeContext) {
      
        def getMetricGroup: MetricGroup = ???
      
        def getDistributedCacheFile(name: String): File = ???
      
        def getJobParameter(key: String, default: String): String = ???
      }
      

      Attachments

        Issue Links

          Activity

            People

              godfreyhe godfrey he
              godfreyhe godfrey he
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: