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

pfzhan pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/kylin5 by this push:
     new 80f8b667b0 Fixes based on static analysis (#2183)
80f8b667b0 is described below

commit 80f8b667b0c096428f357c7beb582730c058c118
Author: Dmitry Kryukov <[email protected]>
AuthorDate: Mon Mar 10 12:22:28 2025 +0300

    Fixes based on static analysis (#2183)
    
    * fixed package name
    
    * exit early if the loop condition is met
    
    * replaced manual array copy
    
    * removed unused StringBuilder
    
    * fixed malformed string format
---
 .../src/main/java/org/apache/kylin/rest/cache/RedisCache.java       | 2 --
 .../src/main/java/org/apache/kylin/job/config/JobMybatisConfig.java | 6 +++---
 .../src/main/java/org/apache/kylin/metadata/tuple/Tuple.java        | 4 +---
 .../java/org/apache/kylin/query/optrule/SumConstantConvertRule.java | 1 +
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/src/common-service/src/main/java/org/apache/kylin/rest/cache/RedisCache.java 
b/src/common-service/src/main/java/org/apache/kylin/rest/cache/RedisCache.java
index 5ef1d8568d..8b49e4c6f0 100644
--- 
a/src/common-service/src/main/java/org/apache/kylin/rest/cache/RedisCache.java
+++ 
b/src/common-service/src/main/java/org/apache/kylin/rest/cache/RedisCache.java
@@ -117,7 +117,6 @@ public class RedisCache extends AbstractKylinCache 
implements KylinCache {
             return;
         }
         Map<String, JedisPool> clusterNodes = jedisCluster.getClusterNodes();
-        StringBuilder masterNodes = new StringBuilder();
         StringBuilder slaveNodes = new StringBuilder();
         masters = Sets.newHashSet();
         Jedis resource = null;
@@ -128,7 +127,6 @@ public class RedisCache extends AbstractKylinCache 
implements KylinCache {
                     slaveNodes.append(host).append(" ");
                 } else {
                     masters.add(host);
-                    masterNodes.append(host).append(" ");
                 }
             } catch (Exception e) {
                 logger.error("redis {} is not reachable", host);
diff --git 
a/src/core-job/src/main/java/org/apache/kylin/job/config/JobMybatisConfig.java 
b/src/core-job/src/main/java/org/apache/kylin/job/config/JobMybatisConfig.java
index ed9502fc87..49f2ff44ce 100644
--- 
a/src/core-job/src/main/java/org/apache/kylin/job/config/JobMybatisConfig.java
+++ 
b/src/core-job/src/main/java/org/apache/kylin/job/config/JobMybatisConfig.java
@@ -54,11 +54,11 @@ import lombok.extern.slf4j.Slf4j;
 @Component
 @Conditional(JobModeCondition.class)
 public class JobMybatisConfig implements InitializingBean {
-    
+
     private static final String CREATE_JOB_INFO_TABLE = 
"create.job.info.table";
-    
+
     private static final String CREATE_JOB_LOCK_TABLE = 
"create.job.lock.table";
-    
+
     private static final String CREATE_JOB_INFO_INDEX_1 = 
"create.job.info.index1";
 
     private static final String CREATE_JOB_INFO_INDEX_2 = 
"create.job.info.index2";
diff --git 
a/src/core-metadata/src/main/java/org/apache/kylin/metadata/tuple/Tuple.java 
b/src/core-metadata/src/main/java/org/apache/kylin/metadata/tuple/Tuple.java
index 6c27bf5422..8e02ee1c3a 100644
--- a/src/core-metadata/src/main/java/org/apache/kylin/metadata/tuple/Tuple.java
+++ b/src/core-metadata/src/main/java/org/apache/kylin/metadata/tuple/Tuple.java
@@ -62,9 +62,7 @@ public class Tuple implements ITuple {
     @Override
     public ITuple makeCopy() {
         Tuple ret = new Tuple(this.info);
-        for (int i = 0; i < this.values.length; ++i) {
-            ret.values[i] = this.values[i];
-        }
+        System.arraycopy(this.values, 0, ret.values, 0, this.values.length);
         return ret;
     }
 
diff --git 
a/src/query/src/main/java/org/apache/kylin/query/optrule/SumConstantConvertRule.java
 
b/src/query/src/main/java/org/apache/kylin/query/optrule/SumConstantConvertRule.java
index 11ce5cd4d7..87925a5832 100644
--- 
a/src/query/src/main/java/org/apache/kylin/query/optrule/SumConstantConvertRule.java
+++ 
b/src/query/src/main/java/org/apache/kylin/query/optrule/SumConstantConvertRule.java
@@ -81,6 +81,7 @@ public class SumConstantConvertRule extends RelOptRule {
             for (AggExpression sumExpr : 
AggExpressionUtil.collectSumExpressions(oldAgg, oldProject)) {
                 if (sumExpr.isSumConst()) {
                     matches = true;
+                    break;
                 }
             }
             return matches;

Reply via email to