[ https://issues.apache.org/jira/browse/FLINK-8868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585993#comment-16585993 ]
ASF GitHub Bot commented on FLINK-8868: --------------------------------------- Xpray 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_r211275617 ########## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/datastream/DataStreamTableFunctionScanRule.scala ########## @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.plan.rules.datastream + +import org.apache.calcite.plan.RelOptRule +import org.apache.calcite.rel.RelNode +import org.apache.calcite.rel.convert.ConverterRule +import org.apache.flink.table.plan.nodes.FlinkConventions +import org.apache.flink.table.plan.nodes.datastream.DataStreamTableFunctionScan +import org.apache.flink.table.plan.nodes.logical.FlinkLogicalTableFunctionScan + +class DataStreamTableFunctionScanRule + extends ConverterRule( + classOf[FlinkLogicalTableFunctionScan], + FlinkConventions.LOGICAL, + FlinkConventions.DATASTREAM, + "DataStreamTableFunctionScanRule" + ) { + + override def convert(rel: RelNode): RelNode = { + val scan: FlinkLogicalTableFunctionScan = rel.asInstanceOf[FlinkLogicalTableFunctionScan] + val traitSet = rel.getTraitSet.replace(FlinkConventions.DATASTREAM) + + new DataStreamTableFunctionScan( Review comment: There might be two cases that TableFunction acts like a Source, one is 'Select * from Lateral Table(udtf())', the other is that the left table do not correlate with the right table so there's no `LogicalCorrelate ` node. ---------------------------------------------------------------- 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)