hanyuzheng7 commented on code in PR #29624:
URL: https://github.com/apache/flink/pull/29624#discussion_r4401513646


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/values/ValuesGeneratorFunction.java:
##########
@@ -19,52 +19,38 @@
 package org.apache.flink.table.runtime.operators.values;
 
 import org.apache.flink.annotation.Internal;
-import org.apache.flink.api.common.io.GenericInputFormat;
 import org.apache.flink.api.connector.source.SourceReaderContext;
 import org.apache.flink.connector.datagen.source.GeneratorFunction;
 import org.apache.flink.table.data.RowData;
-import org.apache.flink.table.runtime.generated.GeneratedInput;
-import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
-import org.apache.flink.table.runtime.typeutils.RowDataSerializer;
-
-import java.util.ArrayList;
-import java.util.List;
+import org.apache.flink.table.runtime.generated.GeneratedFunction;
 
 /**
- * Returns the row of a {@code VALUES} clause for a row number. The generated 
format only reads
- * forward, so {@link #open} reads all rows once.
+ * Returns the row of a {@code VALUES} clause for a row number. It 
instantiates the generated
+ * function when it opens.
  */
 @Internal
 public class ValuesGeneratorFunction implements GeneratorFunction<Long, 
RowData> {
 
     private static final long serialVersionUID = 1L;
 
-    private final GeneratedInput<GenericInputFormat<RowData>> generatedInput;
-    private final InternalTypeInfo<RowData> producedType;
+    private final GeneratedFunction<GeneratorFunction<Long, RowData>> 
generatedFunction;
 
-    private transient List<RowData> rows;
+    private transient GeneratorFunction<Long, RowData> function;
 
     public ValuesGeneratorFunction(

Review Comment:
   I'd keep it. `DataGeneratorSource` needs a serializable `GeneratorFunction` 
instance when the job graph is built, but the generated class only exists as 
source code until it's compiled on the TaskManager. `ValuesGeneratorFunction` 
is the class that ships the code and compiles it in `open()`, the same way 
`ValuesInputFormat` does for the generated input format.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to