godfreyhe commented on code in PR #21704:
URL: https://github.com/apache/flink/pull/21704#discussion_r1089919691


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PushProjectIntoTableSourceScanRule.java:
##########
@@ -139,10 +139,23 @@ public void onMatch(RelOptRuleCall call) {
         final FlinkTypeFactory typeFactory = unwrapTypeFactory(scan);
         final ResolvedSchema schema = 
sourceTable.contextResolvedTable().getResolvedSchema();
         final RowType producedType = createProducedType(schema, 
sourceTable.tableSource());
-        final NestedSchema projectedSchema =
+        NestedSchema projectedSchema =
                 NestedProjectionUtil.build(
                         getProjections(project, scan),
                         typeFactory.buildRelNodeRowType(producedType));
+        // we can not perform an empty column query to the table scan, just 
choose the first column
+        // in such case
+        if (projectedSchema.columns().isEmpty()) {
+            if (scan.getRowType().getFieldCount() == 0) {
+                return;
+            }
+            RexInputRef firstFieldRef = RexInputRef.of(0, scan.getRowType());
+            projectedSchema =

Review Comment:
   I clearly remember this case was handled before, maybe the code is removed 
in some refactor/bugfix changes



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