You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/26 07:56:21 UTC

[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #23098: Add `IF NOT EXISTS` to `create sharding table reference rule`

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


##########
features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingTableReferenceRuleStatementUpdater.java:
##########
@@ -35,18 +35,24 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.stream.Collectors;
 
 /**
  * Create sharding table reference rule statement updater.
  */
 public final class CreateShardingTableReferenceRuleStatementUpdater implements RuleDefinitionCreateUpdater<CreateShardingTableReferenceRuleStatement, ShardingRuleConfiguration> {
     
+    private boolean ifNotExists;
+    
     @Override
     public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingTableReferenceRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
         String databaseName = database.getName();
+        ifNotExists = sqlStatement.isIfNotExists();
         checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
-        checkDuplicateRuleNames(databaseName, sqlStatement, currentRuleConfig);
+        if (!ifNotExists) {
+            checkDuplicateRuleNames(databaseName, sqlStatement, currentRuleConfig);

Review Comment:
   Please rename `Duplicate` to `Duplicated`



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org