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 4c997160f5e Fix is need accumulate logic (#33211)
4c997160f5e is described below

commit 4c997160f5e10fe60e2f328214a6c81c0971d6e9
Author: ZhangCheng <[email protected]>
AuthorDate: Fri Oct 11 13:42:42 2024 +0800

    Fix is need accumulate logic (#33211)
---
 .../shardingsphere/proxy/backend/connector/DatabaseConnector.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java
 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java
index b68d8724443..39c7763b609 100644
--- 
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java
+++ 
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnector.java
@@ -334,11 +334,15 @@ public final class DatabaseConnector implements 
DatabaseBackendHandler {
     }
     
     private boolean isNeedAccumulate() {
-        Collection<DataNodeRuleAttribute> ruleAttributes = 
database.getRuleMetaData().getAttributes(DataNodeRuleAttribute.class);
         Collection<String> tableNames = queryContext.getSqlStatementContext() 
instanceof TableAvailable
                 ? ((TableAvailable) 
queryContext.getSqlStatementContext()).getTablesContext().getTableNames()
                 : Collections.emptyList();
-        return !ruleAttributes.isEmpty() && 
ruleAttributes.iterator().next().isNeedAccumulate(tableNames);
+        for (DataNodeRuleAttribute each : 
database.getRuleMetaData().getAttributes(DataNodeRuleAttribute.class)) {
+            if (each.isNeedAccumulate(tableNames)) {
+                return true;
+            }
+        }
+        return false;
     }
     
     /**

Reply via email to