mumuhhh commented on code in PR #24600: URL: https://github.com/apache/flink/pull/24600#discussion_r1600843684
########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/utils/DynamicPartitionPruningUtils.java: ########## @@ -236,6 +238,9 @@ private void setTables(ContextResolvedTable catalogTable) { tables.add(catalogTable); } else { for (ContextResolvedTable thisTable : new ArrayList<>(tables)) { + if (tables.contains(catalogTable)) { Review Comment: > 我想我们可以在这里使用布尔标志来检查,那么我们不需要每次都调用方法,它是 O(N) 时间复杂度。`contains` > > ``` > boolean hasAdded = false; > for (ContextResolvedTable thisTable : new ArrayList<>(tables)) { > if (hasAdded) { > break; > } > if (!thisTable.getIdentifier().equals(catalogTable.getIdentifier())) { > tables.add(catalogTable); > hasAdded = true; > } > } > ``` I think we should modify the traversal logic. ``` boolean hasAdded = false; for (ContextResolvedTable thisTable : new ArrayList<>(tables)) { if (thisTable.getIdentifier().equals(catalogTable.getIdentifier())) { hasAdded = true; break; } } if (!hasAdded) { tables.add(catalogTable); } ``` -- 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