You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/20 06:47:26 UTC

[jira] [Commented] (FLINK-5571) add open and close methods for UserDefinedFunction in TableAPI & SQL

    [ https://issues.apache.org/jira/browse/FLINK-5571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15831296#comment-15831296 ] 

ASF GitHub Bot commented on FLINK-5571:
---------------------------------------

GitHub user godfreyhe opened a pull request:

    https://github.com/apache/flink/pull/3176

    [FLINK-5571] [table] add open and close methods for UserDefinedFunction

    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. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/godfreyhe/flink udf-open-close

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/3176.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3176
    
----
commit 4ac2be7b3ab4dc0e8a18e43c79a031d7a16ee1ea
Author: godfreyhe <go...@163.com>
Date:   2017-01-20T06:42:12Z

    add open and close methods for UserDefinedFunction

----


> add open and close methods for UserDefinedFunction in TableAPI & SQL
> --------------------------------------------------------------------
>
>                 Key: FLINK-5571
>                 URL: https://issues.apache.org/jira/browse/FLINK-5571
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API & SQL
>            Reporter: godfrey he
>            Assignee: godfrey he
>
> 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:
> {code}
> trait UserDefinedFunction {
>   def open(context: UDFContext): Unit = {}
>   def close(): Unit = {}
> }
> {code}
> UDFContext contains the information about metric reporters, job parameters, distribute cache, etc. The code cloud look like:
> {code}
> class UDFContext(context: RuntimeContext) {
>   def getMetricGroup: MetricGroup = ???
>   def getDistributedCacheFile(name: String): File = ???
>   def getJobParameter(key: String, default: String): String = ???
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)