You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "Xu Mingmin (JIRA)" <ji...@apache.org> on 2017/07/24 20:32:00 UTC

[jira] [Commented] (BEAM-2445) DSL SQL to use service locator pattern to automatically register UDFs

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

Xu Mingmin commented on BEAM-2445:
----------------------------------

Talked with Luke, we plan to enable service loader for UDFs in both CLI and DSL, as:
1). for CLI
The service loader is called by
{code}
add jar [load] [force|ignore|error] /path/to/jar
{code}
, it loads all functions automate and handle any potential conflict as {{[force|ignore|error]}}

Meanwhile, the traditional usage is also kept, whenever user prefer it, also in case of resolving conflict of auto load
{code}
add jar /path/to/jar
add funtion fun_name path.to.udf.class
{code}

2). for DSL
DSL can also benefit from this service loader, to avoid a long chain of {{withUdf().withUdf().withUdf()...}}

The service is proposed as 
{code}
interface UdfRegistrar {
  Map<String, Class<?>> udfsByName();
}
{code}
UDF developer can leverage it to enable service loader.

> DSL SQL to use service locator pattern to automatically register UDFs
> ---------------------------------------------------------------------
>
>                 Key: BEAM-2445
>                 URL: https://issues.apache.org/jira/browse/BEAM-2445
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Luke Cwik
>            Assignee: James Xu
>            Priority: Minor
>
> Use a service locator pattern to find UDFs that can be registered. The service loader can be used to register UDFs for standard functions via DSL SQL, additional UDFs registered by third party libraries, and end user created UDFs.
> Example ServiceLoader usage within Apache Beam to find coder providers:
> https://github.com/apache/beam/blob/7126fdc6ee5671e99a2dede3f25ba616aa0e8fa4/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/CoderRegistry.java#L147



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)