[ https://issues.apache.org/jira/browse/FLINK-8868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585939#comment-16585939 ]
ASF GitHub Bot commented on FLINK-8868: --------------------------------------- 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: us...@infra.apache.org > Support Table Function as Table for Stream Sql > ---------------------------------------------- > > Key: FLINK-8868 > URL: https://issues.apache.org/jira/browse/FLINK-8868 > Project: Flink > Issue Type: Improvement > Components: Table API & SQL > Reporter: Ruidong Li > Assignee: Ruidong Li > Priority: Major > Labels: pull-request-available > > for stream sql: > support SQL like: SELECT * FROM Lateral TABLE(tf("a")) > for batch sql: > udtf might produce infinite recors, it need to be discussed -- This message was sent by Atlassian JIRA (v7.6.3#76005)