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

terrymanu 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 0083c4c9643 Fix DROP SHARDING TABLE RULE ignoring tables that differ 
only in case (#39996)
0083c4c9643 is described below

commit 0083c4c96435f23cb69b445da9811e97454d11b2
Author: Eunbin Son <[email protected]>
AuthorDate: Mon Oct 5 15:53:15 2026 +0900

    Fix DROP SHARDING TABLE RULE ignoring tables that differ only in case 
(#39996)
---
 RELEASE-NOTES.md                                                  | 1 +
 .../distsql/handler/update/DropShardingTableRuleExecutor.java     | 8 ++------
 .../distsql/handler/update/DropShardingTableRuleExecutorTest.java | 8 ++++++++
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 143b8736dc8..b18f8fcea1a 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -56,6 +56,7 @@
 1. DistSQL: Match mask table names case-insensitively in create and alter 
executors - [#39361](https://github.com/apache/shardingsphere/pull/39361)
 1. DistSQL: Fix shadow DistSQL rejecting unquoted `SQL_HINT` algorithm type - 
[#39873](https://github.com/apache/shardingsphere/pull/39873)
 1. DistSQL: Fix duplicate key generator check when altering key generate 
strategy - [#39997](https://github.com/apache/shardingsphere/pull/39997)
+1. DistSQL: Fix `DROP SHARDING TABLE RULE` ignoring tables that differ only in 
case - [#39996](https://github.com/apache/shardingsphere/pull/39996)
 1. JDBC: Fix stale generated values leaking into prepared statement 
executeBatch calls without pending batches - 
[#38160](https://github.com/apache/shardingsphere/pull/38160)
 1. JDBC: Fix MySQL-compatible typed string conversion for 
`ResultSet#getObject(index, Class<T>)` - 
[#38444](https://github.com/apache/shardingsphere/pull/38444)
 1. JDBC: Fix statement close invalidating live result sets of other statements 
on the same connection - 
[#39503](https://github.com/apache/shardingsphere/pull/39503)
diff --git 
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutor.java
 
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutor.java
index e3f370ace70..68681071ae8 100644
--- 
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutor.java
+++ 
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutor.java
@@ -33,8 +33,6 @@ import 
org.apache.shardingsphere.sharding.distsql.statement.DropShardingTableRul
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 
 import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
 import java.util.stream.Collectors;
 
 /**
@@ -91,10 +89,8 @@ public final class DropShardingTableRuleExecutor implements 
DatabaseRuleDropExec
     
     @Override
     public boolean hasAnyOneToBeDropped(final DropShardingTableRuleStatement 
sqlStatement) {
-        Collection<String> currentTableNames = new LinkedList<>();
-        
currentTableNames.addAll(rule.getConfiguration().getTables().stream().map(ShardingTableRuleConfiguration::getLogicTable).collect(Collectors.toSet()));
-        
currentTableNames.addAll(rule.getConfiguration().getAutoTables().stream().map(ShardingAutoTableRuleConfiguration::getLogicTable).collect(Collectors.toSet()));
-        return !Collections.disjoint(currentTableNames, 
sqlStatement.getTableNames().stream().map(each -> 
each.getIdentifier().getValue()).collect(Collectors.toSet()));
+        Collection<String> currentTableNames = getCurrentShardingTableNames();
+        return 
getToBeDroppedShardingTableNames(sqlStatement).stream().anyMatch(currentTableNames::contains);
     }
     
     @Override
diff --git 
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutorTest.java
 
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutorTest.java
index 218f825fffe..f206c609b9c 100644
--- 
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutorTest.java
+++ 
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleExecutorTest.java
@@ -86,6 +86,14 @@ class DropShardingTableRuleExecutorTest {
         assertThrows(InUsedRuleException.class, () -> 
executor.checkBeforeUpdate(createSQLStatement("t_order_item")));
     }
     
+    @Test
+    void assertHasAnyOneToBeDropped() {
+        ShardingRule rule = mock(ShardingRule.class);
+        
when(rule.getConfiguration()).thenReturn(createCurrentRuleConfiguration());
+        executor.setRule(rule);
+        
assertTrue(executor.hasAnyOneToBeDropped(createSQLStatement("T_ORDER")));
+    }
+    
     @Test
     void assertUpdate() {
         ShardingRule rule = mock(ShardingRule.class);

Reply via email to