[
https://issues.apache.org/jira/browse/FLINK-8863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16492857#comment-16492857
]
ASF GitHub Bot commented on FLINK-8863:
---------------------------------------
GitHub user xccui opened a pull request:
https://github.com/apache/flink/pull/6090
[FLINK-8863] [SQL] Add user-defined function support in SQL Client
## What is the purpose of the change
This PR aims to add user-defined function (ScalarFunction, TableFunction
and AggregateFunction) support to the SQL Client.
## Brief change log
- Introduce a new `HierarchyDescriptor` and its corresponding validator
`HierarchyDescriptorValidator`, which allow constructing descriptors
hierarchically.
- Add a `PrimitiveTypeDescriptor` to describe a primitive type value and
a `ClassTypeDescriptor` to describe a class type value. A `ClassTypeDescriptor`
contains a `constructor` field, which is composed of a list of
`PrimitiveTypeDescriptor` or `ClassTypeDescriptor`.
- Add a `UDFDescriptor` and its base class `FunctionDescriptor` to
describe a `UserDefinedFunction`. Given a `DescriptorProperties`, a
`UserDefinedFunction` can be instantiated with the
`FunctionValidator.generateUserDefinedFunction()` method.
- Add related tests for the new components.
## Verifying this change
The change can be verified with the test cases added in
`LocalExecutorITCase.java`.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (no)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: (no)
- The serializers: (no)
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (yes)
- If yes, how is the feature documented? (*the doc has not been finished
yet*)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/xccui/flink FLINK-8863-udf
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/6090.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 #6090
----
commit c6c7d63f96eda01e24735271859ea8528e229021
Author: Xingcan Cui <xingcanc@...>
Date: 2018-05-27T15:36:25Z
[FLINK-8863] Add user-defined function support in SQL Client
----
> Add user-defined function support in SQL Client
> -----------------------------------------------
>
> Key: FLINK-8863
> URL: https://issues.apache.org/jira/browse/FLINK-8863
> Project: Flink
> Issue Type: Sub-task
> Components: Table API & SQL
> Reporter: Timo Walther
> Assignee: Xingcan Cui
> Priority: Major
>
> This issue is a subtask of part two "Full Embedded SQL Client" of the
> implementation plan mentioned in
> [FLIP-24|https://cwiki.apache.org/confluence/display/FLINK/FLIP-24+-+SQL+Client].
>
> It should be possible to declare user-defined functions in the SQL client.
> For now, we limit the registration to classes that implement
> {{ScalarFunction}}, {{TableFunction}}, {{AggregateFunction}}. Functions that
> are implemented in SQL are not part of this issue.
> I would suggest to introduce a {{functions}} top-level property. The
> declaration could look similar to:
> {code}
> functions:
> - name: testFunction
> from: class <-- optional, default: class
> class: org.my.MyScalarFunction
> constructor: <-- optional, needed for certain types of functions
> - 42.0
> - class: org.my.Class <-- possibility to create objects via properties
> constructor:
> - 1
> - true
> - false
> - "whatever"
> - type: INT
> value: 1
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)