You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/06/18 04:58:37 UTC

[shardingsphere] branch master updated: Fix sonar issue on BroadcastSQLRouter (#26409)

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 38cba974949 Fix sonar issue on BroadcastSQLRouter (#26409)
38cba974949 is described below

commit 38cba974949cb77585ec4e3532b88a3ceaeb322f
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Jun 18 12:58:32 2023 +0800

    Fix sonar issue on BroadcastSQLRouter (#26409)
---
 .../shardingsphere/broadcast/route/BroadcastSQLRouter.java   | 12 ++++--------
 .../compiler/statement/SQLStatementCompilerEngine.java       |  4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/route/BroadcastSQLRouter.java b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/route/BroadcastSQLRouter.java
index 92a2cab34f3..fa643b5878f 100644
--- a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/route/BroadcastSQLRouter.java
+++ b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/route/BroadcastSQLRouter.java
@@ -78,15 +78,11 @@ public final class BroadcastSQLRouter implements SQLRouter<BroadcastRule> {
         if (sqlStatement instanceof DDLStatement) {
             decorateRouteContextWhenDDLStatement(routeContext, queryContext, database, broadcastRule);
         }
-        if (sqlStatement instanceof DALStatement) {
-            if (isResourceGroupStatement(sqlStatement)) {
-                routeToAllDatabaseInstance(routeContext, database, broadcastRule);
-            }
+        if (sqlStatement instanceof DALStatement && isResourceGroupStatement(sqlStatement)) {
+            routeToAllDatabaseInstance(routeContext, database, broadcastRule);
         }
-        if (sqlStatement instanceof DCLStatement) {
-            if (!isDCLForSingleTable(queryContext.getSqlStatementContext())) {
-                routeToAllDatabaseInstance(routeContext, database, broadcastRule);
-            }
+        if (sqlStatement instanceof DCLStatement && !isDCLForSingleTable(queryContext.getSqlStatementContext())) {
+            routeToAllDatabaseInstance(routeContext, database, broadcastRule);
         }
     }
     
diff --git a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/statement/SQLStatementCompilerEngine.java b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/statement/SQLStatementCompilerEngine.java
index c6c0ec368ac..8603d395d2c 100644
--- a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/statement/SQLStatementCompilerEngine.java
+++ b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/statement/SQLStatementCompilerEngine.java
@@ -38,11 +38,11 @@ public final class SQLStatementCompilerEngine {
     }
     
     /**
-     * Compile sql statement to execution plan.
+     * Compile SQL statement to execution plan.
      *
      * @param cacheKey execution plan cache key
      * @param useCache use cache
-     * @return sql federation execution plan
+     * @return SQL federation execution plan
      */
     public SQLFederationExecutionPlan compile(final ExecutionPlanCacheKey cacheKey, final boolean useCache) {
         return useCache ? executionPlanCache.get(cacheKey) : sqlFederationCompiler.compile(cacheKey.getSqlStatement());