RaigorJiang commented on code in PR #23093:
URL: https://github.com/apache/shardingsphere/pull/23093#discussion_r1056975975


##########
features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableRuleStatementUpdater.java:
##########
@@ -41,6 +47,16 @@ public ShardingRuleConfiguration 
buildToBeCreatedRuleConfiguration(final CreateS
     
     @Override
     public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration 
currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
+        if (ifNotExists) {
+            Collection<String> currentTables = new LinkedList<>();
+            currentRuleConfig.getTables().forEach(each -> 
currentTables.add(each.getLogicTable()));
+            currentRuleConfig.getAutoTables().forEach(each -> 
currentTables.add(each.getLogicTable()));
+            
toBeCreatedRuleConfig.getTables().removeIf(shardingTableRuleConfiguration -> 
currentTables.contains(shardingTableRuleConfiguration.getLogicTable()));

Review Comment:
   `shardingTableRuleConfiguration` can be replaced with `each` 



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