pnowojski commented on a change in pull request #6574: [FLINK-8868] [table]
Support Table Function as Table Source for Stream Sql
URL: https://github.com/apache/flink/pull/6574#discussion_r211247170
##########
File path:
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/stream/sql/SqlITCase.scala
##########
@@ -897,6 +897,45 @@ class SqlITCase extends StreamingWithStateTestBase {
assertEquals(List(expected.toString()), StreamITCase.testResults.sorted)
}
+
+ @Test
+ def tableFunctionAsSource(): Unit = {
+ val env = StreamExecutionEnvironment.getExecutionEnvironment
+ val tEnv = TableEnvironment.getTableEnvironment(env)
+ StreamITCase.clear
+ tEnv.registerFunction("udtf", new
JavaUserDefinedTableFunctions.JavaVarsArgTableFunc0)
+ val sql = "select a from LATERAL Table(udtf(3, 'hello')) as T(a)"
+ val result = tEnv.sqlQuery(sql).toAppendStream[Row]
+ result.addSink(new StreamITCase.StringSink[Row])
+ env.execute()
+ assertEquals(List("hello", "hello", "hello"),
StreamITCase.testResults.sorted)
+ }
+
+ @Test
+ def tableFunctionAsSourceWithRowType(): Unit = {
+ val env = StreamExecutionEnvironment.getExecutionEnvironment
+ val tEnv = TableEnvironment.getTableEnvironment(env)
+ StreamITCase.clear
+ tEnv.registerFunction("udtf", new TableFunc2WithBase)
Review comment:
Do we need this `TableFunc2WithBase` here? Couldn't we use `TableFunc2`?
What does `TableFunc2WithBase` give us?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services