swuferhong commented on code in PR #20596:
URL: https://github.com/apache/flink/pull/20596#discussion_r950775227


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/physical/batch/DynamicPartitionPruningRule.java:
##########
@@ -138,30 +137,26 @@ private static List<Integer> getAcceptedFieldIndices(
                             .map(i -> 
factScan.getRowType().getFieldNames().get(i))
                             .collect(Collectors.toList());
         }
+        List<String> acceptedFilterFieldsInSource =
+                ((SupportsDynamicFiltering) 
tableSource).listAcceptedFilterFields();
 
-        List<String> acceptedFields =
-                ((SupportsDynamicFiltering) 
tableSource).applyDynamicFiltering(candidateFields);
-
-        if (acceptedFields == null) {
-            return new ArrayList<>();
-        }
-
-        for (String field : acceptedFields) {
-            if (!candidateFields.contains(field)) {
-                throw new TableException(
-                        String.format(
-                                "Field: %s does not exist in the given fields: 
%s, "
-                                        + "please verify the 
applyDynamicFiltering method in connector: %s",
-                                field, candidateFields, 
tableSource.asSummaryString()));
+        List<String> acceptedFilterFields = new ArrayList<>();
+        for (String candidateField : candidateFields) {
+            if (acceptedFilterFieldsInSource.contains(candidateField)) {
+                acceptedFilterFields.add(candidateField);
             }
         }

Review Comment:
   > extract a common method which can be reused by DynamicPartitionPruningRule
   
   Done!



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