[
https://issues.apache.org/jira/browse/FLINK-8868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16585943#comment-16585943
]
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_r211270485
##########
File path:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/SourceFunctionCodeGenerator.scala
##########
@@ -0,0 +1,101 @@
+/*
+ * 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.codegen
+
+import org.apache.flink.api.common.typeinfo.TypeInformation
+import org.apache.flink.api.java.typeutils.RowTypeInfo
+import org.apache.flink.configuration.Configuration
+import org.apache.flink.table.api.TableConfig
+import org.apache.flink.streaming.api.functions.source.RichSourceFunction
+import
org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext
+import org.apache.flink.table.codegen.CodeGenUtils.newName
+import org.apache.flink.util.Collector
+
+/**
+ * A code generator for generating Flink [[RichSourceFunction]].
+ *
+ * @param config configuration that determines runtime behavior
+ */
+class SourceFunctionCodeGenerator[T](
+ config: TableConfig,
+ outputType: TypeInformation[T])
+ extends CodeGenerator(config, false, new RowTypeInfo(), None, None) {
+
+ def generateSourceFunction(
Review comment:
Sorry for asking maybe a stupid question. Why do we need to generate so much
code? Should most of the code here (all even all of it) be in standard
scala/java classes and the only thing that should be generate is a `RexCall` as
as an implementation of some interface, that should be used by some concrete
java/scala class?
In other words, generating implementation of `RichSourceFunction` seams like
a bit an overkill.
----------------------------------------------------------------
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]
> 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)