[ https://issues.apache.org/jira/browse/FLINK-6355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15979182#comment-15979182 ]
Fabian Hueske commented on FLINK-6355: -------------------------------------- You could also define {{tableEnv}} as {{StreamTableEnvironment}} instead of {{TableEnvironment}}. This would allow to register the {{TableFunction}} and make the cast unnecessary to call {{fromDataStream()}}. > TableEnvironment support register TableFunction > ----------------------------------------------- > > Key: FLINK-6355 > URL: https://issues.apache.org/jira/browse/FLINK-6355 > Project: Flink > Issue Type: Improvement > Components: Table API & SQL > Reporter: Kaibo Zhou > Assignee: Kaibo Zhou > > Currently {{TableEnvironment}} only supports register ScalarFunction, the > Java users cannot use {{TableEnvironment}} to register {{TableFunction}}. > This is the test code: > TableFunc0.scala > {quote} > class TableFunc0 extends TableFunction[String] { > def eval(str: String): Unit = { > // do somethings... > } > } > {quote} > UserMainClass.java > {quote} > TableEnvironment tableEnv = ... > DataStream<Tuple3<Integer, Long, String>> ds = > StreamTestData.getSmall3TupleDataSet2(env); > Table in = ((StreamTableEnvironment)tableEnv).fromDataStream(ds, "a,b,c"); > TableFunc0 tableFunc0 = new TableFunc0(); > tableEnv.registerFunction("func0", tableFunc0); // compile error here > Table result = in.join("func0(c) as d") > .select("c, d"); > ... > {quote} > There will be compilation errors in registerFunction: "Found > xx.xxx.TableFunc0,required org.apache.flink.table.functions.ScalarFunction"。 > I did some testing, only Java users have this problem. -- This message was sent by Atlassian JIRA (v6.3.15#6346)