luoyuxia commented on code in PR #23423: URL: https://github.com/apache/flink/pull/23423#discussion_r1351171194
########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PushPartitionIntoTableSourceScanRule.java: ########## @@ -176,6 +177,14 @@ public void onMatch(RelOptRuleCall call) { defaultPruner, allPredicates._1(), inputFieldNames); + + // If remaining partitions are empty, it means that there are no partitions are selected + // after partition prune. We can directly optimize the RelNode to Empty FlinkLogicalValues. + if (remainingPartitions.isEmpty()) { + RelNode emptyValue = relBuilder.push(filter).empty().build(); Review Comment: Can it be `relBuilder.empty().build()`? ########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PushPartitionIntoTableSourceScanRule.java: ########## @@ -176,6 +177,14 @@ public void onMatch(RelOptRuleCall call) { defaultPruner, allPredicates._1(), inputFieldNames); + + // If remaining partitions are empty, it means that there are no partitions are selected + // after partition prune. We can directly optimize the RelNode to Empty FlinkLogicalValues. + if (remainingPartitions.isEmpty()) { + RelNode emptyValue = relBuilder.push(filter).empty().build(); + call.transformTo(emptyValue); Review Comment: return after this line? -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org