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

Kaibo Zhou commented on FLINK-6355:
-----------------------------------

Thanks  [~fhueske]

I have updated the description and add some test code. Only Java users have 
this problem.

Yes, I want to remove those registerFunctions methods and add one method to 
base class {{TableEnvironment}}. As you said, there may be compatibility 
issues, I will do some testing to see if this is feasible.

My motivation is to eliminate most of the differences between the batch and the 
streaming execution environment, and support the use of the TableEnvironment to 
write programs only.

Thanks

> 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 = {
>     ...
>   }
> }
> {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)

Reply via email to