Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
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
- is related to
-
FLINK-6040 DataStreamUserDefinedFunctionITCase occasionally fails
- Closed
- links to