This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new d185c20df6d Fix sonar issue (#29894)
d185c20df6d is described below

commit d185c20df6db9ea3f165892a4a0310564c8ef119
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jan 29 12:09:31 2024 +0800

    Fix sonar issue (#29894)
    
    * Rename DropReadwriteSplittingRuleExecutor
    
    * Keep DistSQLExecutor's test case consistent
    
    * Fix sonar issue
---
 .../validator/ddl/impl/ShardingDropTableStatementValidator.java       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
index 3a4987ba45e..0913ab19cc1 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
@@ -77,13 +77,13 @@ public final class ShardingDropTableStatementValidator 
extends ShardingDDLStatem
     
     private void checkTableInUsed(final ShardingRule shardingRule, final 
SQLStatementContext sqlStatementContext, final RouteContext routeContext) {
         Collection<String> dropTables = 
sqlStatementContext.getTablesContext().getTableNames();
-        Set<String> actualTables = 
routeContext.getRouteUnits().stream().flatMap(each -> 
each.getTableMappers().stream().map(RouteMapper::getActualName)).collect(Collectors.toSet());
-        // TODO check actual tables not be used in multi rules, and remove 
this check logic
         Collection<String> otherRuleActualTables = 
shardingRule.getTableRules().values().stream().filter(each -> 
!dropTables.contains(each.getLogicTable()))
                 .flatMap(each -> 
each.getActualDataNodes().stream().map(DataNode::getTableName)).collect(Collectors.toCollection(CaseInsensitiveSet::new));
         if (otherRuleActualTables.isEmpty()) {
             return;
         }
+        // TODO check actual tables not be used in multi rules, and remove 
this check logic
+        Set<String> actualTables = 
routeContext.getRouteUnits().stream().flatMap(each -> 
each.getTableMappers().stream().map(RouteMapper::getActualName)).collect(Collectors.toSet());
         Collection<String> inUsedTables = 
actualTables.stream().filter(otherRuleActualTables::contains).collect(Collectors.toList());
         ShardingSpherePreconditions.checkState(inUsedTables.isEmpty(), () -> 
new DropInUsedTablesException(inUsedTables));
     }

Reply via email to