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


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecValues.java:
##########
@@ -69,16 +71,36 @@ protected Transformation<RowData> translateToPlanInternal(
                         (RowType) getOutputType(),
                         tuples,
                         getClass().getSimpleName());
-        final Transformation<RowData> transformation =
-                planner.getExecEnv()
-                        .createInput(inputFormat, 
inputFormat.getProducedType())
-                        .getTransformation();
+        final Transformation<RowData> transformation;
+        // Without rows, VALUES keeps the legacy source: a DataGeneratorSource 
emits at least one.
+        if (legacySourceEnabled() || tuples.isEmpty()) {
+            transformation =
+                    planner.getExecEnv()
+                            .createInput(inputFormat, 
inputFormat.getProducedType())
+                            .getTransformation();
+        } else {
+            transformation =
+                    planner.getExecEnv()
+                            .fromSource(
+                                    new ValuesSource(inputFormat, 
tuples.size()),
+                                    WatermarkStrategy.noWatermarks(),
+                                    VALUES_TRANSFORMATION)
+                            .getTransformation();
+        }

Review Comment:
   The new source can run in parallel, but `CommonExecValues` still sets 
parallelism 1 and max parallelism 1 on it, like on the legacy source. So it 
runs as a single reader with a single split, the same as before. 



-- 
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