swuferhong commented on code in PR #20594:
URL: https://github.com/apache/flink/pull/20594#discussion_r948917616
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/physical/batch/DynamicPartitionPruningRule.java:
##########
@@ -152,9 +152,39 @@ private static List<Integer> getAcceptedFieldIndices(
}
}
- return acceptedFields.stream()
- .map(f -> factScan.getRowType().getFieldNames().indexOf(f))
- .collect(Collectors.toList());
+ if (factCalc == null) {
+ return acceptedFields.stream()
+ .map(f -> factScan.getRowType().getFieldNames().indexOf(f))
+ .collect(Collectors.toList());
+ } else {
+ return getAcceptedFieldsIndicesInCalc(acceptedFields,
factJoinKeys, factCalc, factScan);
+ }
+ }
+
+ private static List<Integer> getAcceptedFieldsIndicesInCalc(
+ @Nullable List<String> acceptedFields,
+ List<Integer> factJoinKeys,
+ BatchPhysicalCalc factCalc,
+ BatchPhysicalTableSourceScan factScan) {
+ if (acceptedFields == null) {
Review Comment:
> acceptedFields should not be null, otherwise NPE will be thrown at line
145. So we should add Null check at line 145
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]