flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-5571) add open and close methods for UserDefinedFunction in TableAPI & SQL
Date Wed, 15 Feb 2017 12:48:42 GMT

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

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

Github user twalthr commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3176#discussion_r101248702
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/UDFContext.scala
---
    @@ -0,0 +1,53 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.table.functions
    +
    +import java.io.File
    +
    +import org.apache.flink.annotation.PublicEvolving
    +import org.apache.flink.api.common.functions.RuntimeContext
    +import org.apache.flink.metrics.MetricGroup
    +
    +class UDFContext(context: RuntimeContext) {
    --- End diff --
    
    Please also add a Javadoc here.


> 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.15#6346)

Mime
View raw message