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

add open and close methods for UserDefinedFunction in TableAPI & SQL

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: Table API & SQL
    • Labels:
      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

              • Assignee:
                godfreyhe godfrey he
                Reporter:
                godfreyhe godfrey he
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: