[
https://issues.apache.org/jira/browse/FLINK-6355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kaibo Zhou updated FLINK-6355:
------------------------------
Description:
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.
was:
Currently TableEnvironment only supports register ScalarFunction, it is
necessary to support register TableFunction which is written in Java.
The motivation is to eliminate most differences between batch and stream
execution environment, and use TableEnvironment only to write programs.
> 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)