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


##########
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()) {

Review Comment:
   `DataGeneratorSource` can't emit zero records. It uses 
`NumberSequenceSource(0, count > 0 ? count - 1 : 0)`, and 
`NumberSequenceSource` requires `from <= to`, so a count of 0 still emits one 
record. VALUES without rows has nothing to emit again, so I kept the legacy 
source for it. If you want, I can make `DataGeneratorSource` support a count of 
0 in a separate PR."



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