[ https://issues.apache.org/jira/browse/FLINK-3097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15034838#comment-15034838 ]
ASF GitHub Bot commented on FLINK-3097: --------------------------------------- GitHub user twalthr opened a pull request: https://github.com/apache/flink/pull/1429 [FLINK-3097] [table] Add support for custom functions in Table API As described in FLINK-3097, this PR implements the possibility of adding custom row functions for the Table API. In the tests you can find some examples how custom functions can look like: ``` table.select("TRIM(f0)") table.select("SYSTEM_TIME()") table.select("SUBSTRING(SUBSTRING(f0, 2, 5), 0, 1)") table.select("SUBSTRING(f0, 1), SUBSTRING(f0, 2, 5)") ``` The Scala Table API is not supported yet, since I'm still waiting for #1237. You can merge this pull request into a Git repository by running: $ git pull https://github.com/twalthr/flink TableApiCustomFunctions Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/1429.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 #1429 ---- commit f6677487d3fe48042f521226aa4e8358433e1f9c Author: twalthr <twal...@apache.org> Date: 2015-11-29T15:15:16Z [FLINK-3097] [table] Add support for custom functions in Table API ---- > Add support for custom functions in Table API > --------------------------------------------- > > Key: FLINK-3097 > URL: https://issues.apache.org/jira/browse/FLINK-3097 > Project: Flink > Issue Type: New Feature > Components: Table API > Reporter: Timo Walther > Assignee: Timo Walther > > Currently, the Table API has a very limited set of built-in functions. > Support for custom functions can solve this problem. Adding of a custom row > function could look like: > {code} > TableEnvironment tableEnv = new TableEnvironment(); > RowFunction<String> rf = new RowFunction<String>() { > @Override > public String call(Object[] args) { > return ((String) args[0]).trim(); > } > }; > tableEnv.getConfig().registerRowFunction("TRIM", rf, > BasicTypeInfo.STRING_TYPE_INFO); > DataSource<Tuple1<String>> input = env.fromElements( > new Tuple1<>(" 1 ")); > Table table = tableEnv.fromDataSet(input); > Table result = table.select("TRIM(f0)"); > {code} > This feature is also necessary as part of FLINK-2099. -- This message was sent by Atlassian JIRA (v6.3.4#6332)