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

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


The following commit(s) were added to refs/heads/master by this push:
     new 47d6982be53 Fix sonar bugs and code smells in protocol  (#10364)
47d6982be53 is described below

commit 47d6982be534fb08658d297277ccf3c68fb3fb20
Author: ppppoooo <[email protected]>
AuthorDate: Thu Jun 29 11:22:00 2023 +0800

    Fix sonar bugs and code smells in protocol  (#10364)
---
 .../iotdb/db/protocol/client/ConfigNodeClient.java | 151 +++++++++++----------
 .../protocol/client/ConfigNodeClientManager.java   |   2 +
 .../db/protocol/client/DataNodeInternalClient.java |  12 +-
 .../db/protocol/mqtt/JSONPayloadFormatter.java     |   2 +-
 .../iotdb/db/protocol/mqtt/MPPPublishHandler.java  |  10 +-
 .../db/protocol/mqtt/PayloadFormatManager.java     |   3 +
 .../db/protocol/rest/filter/ApiOriginFilter.java   |   8 +-
 .../protocol/rest/filter/AuthorizationFilter.java  |   8 +-
 .../rest/v1/handler/QueryDataSetHandler.java       |  16 ---
 .../rest/v1/impl/GrafanaApiServiceImpl.java        |  20 +--
 .../protocol/rest/v1/impl/RestApiServiceImpl.java  |  20 +--
 .../rest/v2/handler/QueryDataSetHandler.java       |  16 ---
 .../rest/v2/impl/GrafanaApiServiceImpl.java        |  20 +--
 .../protocol/rest/v2/impl/RestApiServiceImpl.java  |  20 +--
 .../handler/InternalServiceThriftHandler.java      |   8 +-
 .../handler/MLNodeRPCServiceThriftHandler.java     |   8 +-
 .../protocol/thrift/impl/ClientRPCServiceImpl.java |  55 ++++----
 .../impl/DataNodeInternalRPCServiceImpl.java       |  56 ++++----
 .../thrift/impl/DataNodeRegionManager.java         |   7 +-
 .../protocol/thrift/impl/MLNodeRPCServiceImpl.java |  20 ++-
 20 files changed, 223 insertions(+), 239 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
index c066dbe2eaa..eee272c71a1 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
@@ -156,6 +156,9 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
   public static final String MSG_RECONNECTION_FAIL =
       "Fail to connect to any config node. Please check status of ConfigNodes";
 
+  private static final String MSG_RECONNECTION_DATANODE_FAIL =
+      "Failed to connect to ConfigNode {} from DataNode {} when executing {}";
+
   private static final int RETRY_INTERVAL_MS = 1000;
 
   private final ThriftClientProperty property;
@@ -322,7 +325,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -351,7 +354,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         configNodes = newConfigNodes;
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -372,7 +375,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -393,7 +396,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -430,7 +433,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -451,7 +454,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -472,7 +475,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -493,7 +496,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -514,7 +517,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -535,7 +538,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -556,7 +559,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -577,7 +580,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -599,7 +602,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -621,7 +624,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -642,7 +645,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -663,7 +666,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -684,7 +687,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -705,7 +708,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -727,7 +730,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -749,7 +752,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -771,7 +774,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -792,7 +795,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -814,7 +817,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -835,7 +838,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -856,7 +859,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -877,7 +880,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -898,7 +901,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -960,7 +963,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -981,7 +984,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1002,7 +1005,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1023,7 +1026,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1044,7 +1047,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1070,7 +1073,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1091,7 +1094,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1112,7 +1115,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1134,7 +1137,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1155,7 +1158,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1176,7 +1179,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1197,7 +1200,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1223,7 +1226,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1244,7 +1247,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1297,7 +1300,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1318,7 +1321,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1340,7 +1343,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1360,7 +1363,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1381,7 +1384,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1402,7 +1405,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1423,7 +1426,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1444,7 +1447,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1465,7 +1468,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1502,7 +1505,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1523,7 +1526,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1544,7 +1547,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1565,7 +1568,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1586,7 +1589,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1607,7 +1610,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1644,7 +1647,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1665,7 +1668,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1686,7 +1689,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1707,7 +1710,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1728,7 +1731,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1749,7 +1752,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1770,7 +1773,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1791,7 +1794,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1812,7 +1815,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1833,7 +1836,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1854,7 +1857,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1875,7 +1878,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1896,7 +1899,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1933,7 +1936,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1954,7 +1957,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1974,7 +1977,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -1995,7 +1998,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
@@ -2016,7 +2019,7 @@ public class ConfigNodeClient implements 
IConfigNodeRPCService.Iface, ThriftClie
         }
       } catch (TException e) {
         logger.warn(
-            "Failed to connect to ConfigNode {} from DataNode {} when 
executing {}",
+            MSG_RECONNECTION_DATANODE_FAIL,
             configNode,
             config.getAddressAndPort(),
             Thread.currentThread().getStackTrace()[1].getMethodName());
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClientManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClientManager.java
index b0914cd3a62..8d376c0a473 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClientManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClientManager.java
@@ -23,6 +23,8 @@ import org.apache.iotdb.commons.client.IClientManager;
 import org.apache.iotdb.commons.consensus.ConfigRegionId;
 
 public class ConfigNodeClientManager {
+  private ConfigNodeClientManager() {}
+
   private static final class ConfigNodeClientManagerHolder {
     private static final IClientManager<ConfigRegionId, ConfigNodeClient> 
INSTANCE =
         new IClientManager.Factory<ConfigRegionId, ConfigNodeClient>()
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/DataNodeInternalClient.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/DataNodeInternalClient.java
index 7de519cb657..da62a47cadc 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/DataNodeInternalClient.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/DataNodeInternalClient.java
@@ -50,15 +50,15 @@ public class DataNodeInternalClient {
 
   private static final SessionManager SESSION_MANAGER = 
SessionManager.getInstance();
 
-  private final IPartitionFetcher PARTITION_FETCHER;
+  private final IPartitionFetcher partitionFetcher;
 
-  private final ISchemaFetcher SCHEMA_FETCHER;
+  private final ISchemaFetcher schemaFetcher;
 
   private final IClientSession session;
 
   public DataNodeInternalClient(SessionInfo sessionInfo) {
-    PARTITION_FETCHER = ClusterPartitionFetcher.getInstance();
-    SCHEMA_FETCHER = ClusterSchemaFetcher.getInstance();
+    partitionFetcher = ClusterPartitionFetcher.getInstance();
+    schemaFetcher = ClusterSchemaFetcher.getInstance();
 
     try {
       session = new InternalClientSession("SELECT_INTO");
@@ -89,8 +89,8 @@ public class DataNodeInternalClient {
               queryId,
               SESSION_MANAGER.getSessionInfo(session),
               "",
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER);
+              partitionFetcher,
+              schemaFetcher);
       return result.status;
     } catch (Exception e) {
       return onNpeOrUnexpectedException(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java
index c464d18e695..bccee477400 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/JSONPayloadFormatter.java
@@ -49,7 +49,7 @@ public class JSONPayloadFormatter implements PayloadFormatter 
{
   @Override
   public List<Message> format(ByteBuf payload) {
     if (payload == null) {
-      return null;
+      return new ArrayList<>();
     }
     String txt = payload.toString(StandardCharsets.UTF_8);
     JsonElement jsonElement = GSON.fromJson(txt, JsonElement.class);
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
index 9b544a612a3..374555dd464 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
@@ -56,7 +56,7 @@ public class MPPPublishHandler extends 
AbstractInterceptHandler {
   private static final Logger LOG = 
LoggerFactory.getLogger(MPPPublishHandler.class);
 
   private static final IoTDBConfig config = 
IoTDBDescriptor.getInstance().getConfig();
-  private final SessionManager SESSION_MANAGER = SessionManager.getInstance();
+  private final SessionManager sessionManager = SessionManager.getInstance();
 
   private final ConcurrentHashMap<String, MqttClientSession> 
clientIdToSessionMap =
       new ConcurrentHashMap<>();
@@ -79,7 +79,7 @@ public class MPPPublishHandler extends 
AbstractInterceptHandler {
   public void onConnect(InterceptConnectMessage msg) {
     if (!clientIdToSessionMap.containsKey(msg.getClientID())) {
       MqttClientSession session = new MqttClientSession(msg.getClientID());
-      SESSION_MANAGER.login(
+      sessionManager.login(
           session,
           msg.getUsername(),
           new String(msg.getPassword()),
@@ -94,7 +94,7 @@ public class MPPPublishHandler extends 
AbstractInterceptHandler {
   public void onDisconnect(InterceptDisconnectMessage msg) {
     MqttClientSession session = clientIdToSessionMap.remove(msg.getClientID());
     if (null != session) {
-      SESSION_MANAGER.closeSession(session, 
Coordinator.getInstance()::cleanupQueryExecution);
+      sessionManager.closeSession(session, 
Coordinator.getInstance()::cleanupQueryExecution);
     }
   }
 
@@ -155,13 +155,13 @@ public class MPPPublishHandler extends 
AbstractInterceptHandler {
         if (tsStatus.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) 
{
           LOG.warn(tsStatus.message);
         } else {
-          long queryId = SESSION_MANAGER.requestQueryId();
+          long queryId = sessionManager.requestQueryId();
           ExecutionResult result =
               Coordinator.getInstance()
                   .execute(
                       statement,
                       queryId,
-                      SESSION_MANAGER.getSessionInfo(session),
+                      sessionManager.getSessionInfo(session),
                       "",
                       partitionFetcher,
                       schemaFetcher,
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java
index ee9fd6aea3f..761cbfd4f19 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/PayloadFormatManager.java
@@ -36,6 +36,9 @@ import java.util.ServiceLoader;
 
 /** PayloadFormatManager loads payload formatter from SPI services. */
 public class PayloadFormatManager {
+
+  private PayloadFormatManager() {}
+
   private static final Logger logger = 
LoggerFactory.getLogger(PayloadFormatManager.class);
 
   // The dir saving MQTT payload plugin .jar files
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/ApiOriginFilter.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/ApiOriginFilter.java
index c5b8a7bba75..aacc2bcc09a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/ApiOriginFilter.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/ApiOriginFilter.java
@@ -38,8 +38,12 @@ public class ApiOriginFilter implements javax.servlet.Filter 
{
   }
 
   @Override
-  public void destroy() {}
+  public void destroy() {
+    // do nothing
+  }
 
   @Override
-  public void init(FilterConfig filterConfig) throws ServletException {}
+  public void init(FilterConfig filterConfig) throws ServletException {
+    // do nothing
+  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/AuthorizationFilter.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/AuthorizationFilter.java
index 68a5f1a8588..8b5a13a7e23 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/AuthorizationFilter.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/filter/AuthorizationFilter.java
@@ -26,8 +26,6 @@ import 
org.apache.iotdb.db.protocol.rest.model.ExecutionStatus;
 import org.apache.iotdb.rpc.TSStatusCode;
 
 import org.glassfish.jersey.internal.util.Base64;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.servlet.annotation.WebFilter;
 import javax.ws.rs.container.ContainerRequestContext;
@@ -43,13 +41,13 @@ import java.io.IOException;
 @Provider
 public class AuthorizationFilter implements ContainerRequestFilter {
 
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(AuthorizationFilter.class);
-
   private final IAuthorizer authorizer = AuthorizerManager.getInstance();
   private final UserCache userCache = UserCache.getInstance();
   IoTDBRestServiceConfig config = 
IoTDBRestServiceDescriptor.getInstance().getConfig();
 
-  public AuthorizationFilter() throws AuthException {}
+  public AuthorizationFilter() throws AuthException {
+    // do nothing
+  }
 
   @Override
   public void filter(ContainerRequestContext containerRequestContext) throws 
IOException {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/handler/QueryDataSetHandler.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/handler/QueryDataSetHandler.java
index 88be81dc12d..01ec4caf470 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/handler/QueryDataSetHandler.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/handler/QueryDataSetHandler.java
@@ -29,10 +29,8 @@ import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.sys.AuthorStatement;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.Path;
 import org.apache.iotdb.tsfile.read.common.block.TsBlock;
 import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
 
 import javax.ws.rs.core.Response;
 
@@ -119,20 +117,6 @@ public class QueryDataSetHandler {
     }
   }
 
-  private static void initTargetDatasetExpByOrderWithSourceDataSet(
-      QueryDataSet sourceDataSet,
-      int[] targetDataSetIndexToSourceDataSetIndex,
-      org.apache.iotdb.db.protocol.rest.v1.model.QueryDataSet targetDataSet) {
-    if (sourceDataSet.getPaths() != null) {
-      for (int i = 0; i < sourceDataSet.getPaths().size(); i++) {
-        Path path = sourceDataSet.getPaths().get(i);
-        targetDataSet.addExpressionsItem(path.getFullPath());
-        targetDataSet.addValuesItem(new ArrayList<>());
-        targetDataSetIndexToSourceDataSetIndex[i] = i;
-      }
-    }
-  }
-
   private static Response fillQueryDataSetWithTimestamps(
       IQueryExecution queryExecution,
       int actualRowSizeLimit,
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/GrafanaApiServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/GrafanaApiServiceImpl.java
index 90adaee341d..d02c5fee123 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/GrafanaApiServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/GrafanaApiServiceImpl.java
@@ -61,16 +61,16 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
 
   private static final SessionManager SESSION_MANAGER = 
SessionManager.getInstance();
 
-  private final IPartitionFetcher PARTITION_FETCHER;
+  private final IPartitionFetcher partitionFetcher;
 
-  private final ISchemaFetcher SCHEMA_FETCHER;
+  private final ISchemaFetcher schemaFetcher;
   private final AuthorizationHandler authorizationHandler;
 
   private final long timePrecision; // the default timestamp precision is ms
 
   public GrafanaApiServiceImpl() {
-    PARTITION_FETCHER = ClusterPartitionFetcher.getInstance();
-    SCHEMA_FETCHER = ClusterSchemaFetcher.getInstance();
+    partitionFetcher = ClusterPartitionFetcher.getInstance();
+    schemaFetcher = ClusterSchemaFetcher.getInstance();
     authorizationHandler = new AuthorizationHandler();
 
     switch 
(CommonDescriptor.getInstance().getConfig().getTimestampPrecision()) {
@@ -114,8 +114,8 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
               queryId,
               null,
               sql.getSql(),
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
           && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
@@ -176,8 +176,8 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
               queryId,
               null,
               sql,
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
           && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
@@ -232,8 +232,8 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
                 queryId,
                 null,
                 sql,
-                PARTITION_FETCHER,
-                SCHEMA_FETCHER,
+                partitionFetcher,
+                schemaFetcher,
                 config.getQueryTimeoutThreshold());
         if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
             && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
index 8a7c69fd5e1..e758b7cd4af 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v1/impl/RestApiServiceImpl.java
@@ -57,16 +57,16 @@ public class RestApiServiceImpl extends RestApiService {
 
   private static final SessionManager SESSION_MANAGER = 
SessionManager.getInstance();
 
-  private final IPartitionFetcher PARTITION_FETCHER;
+  private final IPartitionFetcher partitionFetcher;
 
-  private final ISchemaFetcher SCHEMA_FETCHER;
+  private final ISchemaFetcher schemaFetcher;
   private final AuthorizationHandler authorizationHandler;
 
   private final Integer defaultQueryRowLimit;
 
   public RestApiServiceImpl() {
-    PARTITION_FETCHER = ClusterPartitionFetcher.getInstance();
-    SCHEMA_FETCHER = ClusterSchemaFetcher.getInstance();
+    partitionFetcher = ClusterPartitionFetcher.getInstance();
+    schemaFetcher = ClusterSchemaFetcher.getInstance();
     authorizationHandler = new AuthorizationHandler();
     defaultQueryRowLimit =
         
IoTDBRestServiceDescriptor.getInstance().getConfig().getRestQueryDefaultRowSizeLimit();
@@ -99,8 +99,8 @@ public class RestApiServiceImpl extends RestApiService {
               SESSION_MANAGER.requestQueryId(),
               null,
               sql.getSql(),
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
 
       return Response.ok()
@@ -149,8 +149,8 @@ public class RestApiServiceImpl extends RestApiService {
               queryId,
               null,
               sql.getSql(),
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
           && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
@@ -194,8 +194,8 @@ public class RestApiServiceImpl extends RestApiService {
               SESSION_MANAGER.requestQueryId(),
               null,
               "",
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
 
       return Response.ok()
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/handler/QueryDataSetHandler.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/handler/QueryDataSetHandler.java
index 020955cc88f..5fb7cb8b01e 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/handler/QueryDataSetHandler.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/handler/QueryDataSetHandler.java
@@ -29,10 +29,8 @@ import 
org.apache.iotdb.db.queryengine.plan.statement.metadata.ShowStatement;
 import org.apache.iotdb.db.queryengine.plan.statement.sys.AuthorStatement;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.Path;
 import org.apache.iotdb.tsfile.read.common.block.TsBlock;
 import org.apache.iotdb.tsfile.read.common.block.column.Column;
-import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
 
 import javax.ws.rs.core.Response;
 
@@ -119,20 +117,6 @@ public class QueryDataSetHandler {
     }
   }
 
-  private static void initTargetDatasetExpByOrderWithSourceDataSet(
-      QueryDataSet sourceDataSet,
-      int[] targetDataSetIndexToSourceDataSetIndex,
-      org.apache.iotdb.db.protocol.rest.v2.model.QueryDataSet targetDataSet) {
-    if (sourceDataSet.getPaths() != null) {
-      for (int i = 0; i < sourceDataSet.getPaths().size(); i++) {
-        Path path = sourceDataSet.getPaths().get(i);
-        targetDataSet.addExpressionsItem(path.getFullPath());
-        targetDataSet.addValuesItem(new ArrayList<>());
-        targetDataSetIndexToSourceDataSetIndex[i] = i;
-      }
-    }
-  }
-
   private static Response fillQueryDataSetWithTimestamps(
       IQueryExecution queryExecution,
       int actualRowSizeLimit,
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/GrafanaApiServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/GrafanaApiServiceImpl.java
index 37ef6c9356b..e47863d9678 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/GrafanaApiServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/GrafanaApiServiceImpl.java
@@ -61,16 +61,16 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
 
   private static final SessionManager SESSION_MANAGER = 
SessionManager.getInstance();
 
-  private final IPartitionFetcher PARTITION_FETCHER;
+  private final IPartitionFetcher partitionFetcher;
 
-  private final ISchemaFetcher SCHEMA_FETCHER;
+  private final ISchemaFetcher schemaFetcher;
   private final AuthorizationHandler authorizationHandler;
 
   private final long timePrecision; // the default timestamp precision is ms
 
   public GrafanaApiServiceImpl() {
-    PARTITION_FETCHER = ClusterPartitionFetcher.getInstance();
-    SCHEMA_FETCHER = ClusterSchemaFetcher.getInstance();
+    partitionFetcher = ClusterPartitionFetcher.getInstance();
+    schemaFetcher = ClusterSchemaFetcher.getInstance();
     authorizationHandler = new AuthorizationHandler();
 
     switch 
(CommonDescriptor.getInstance().getConfig().getTimestampPrecision()) {
@@ -114,8 +114,8 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
               queryId,
               null,
               sql.getSql(),
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
           && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
@@ -176,8 +176,8 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
               queryId,
               null,
               sql,
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
           && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
@@ -232,8 +232,8 @@ public class GrafanaApiServiceImpl extends 
GrafanaApiService {
                 queryId,
                 null,
                 sql,
-                PARTITION_FETCHER,
-                SCHEMA_FETCHER,
+                partitionFetcher,
+                schemaFetcher,
                 config.getQueryTimeoutThreshold());
         if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
             && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
index 6600241f777..ff415ad63c9 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java
@@ -57,16 +57,16 @@ public class RestApiServiceImpl extends RestApiService {
 
   private static final SessionManager SESSION_MANAGER = 
SessionManager.getInstance();
 
-  private final IPartitionFetcher PARTITION_FETCHER;
+  private final IPartitionFetcher partitionFetcher;
 
-  private final ISchemaFetcher SCHEMA_FETCHER;
+  private final ISchemaFetcher schemaFetcher;
   private final AuthorizationHandler authorizationHandler;
 
   private final Integer defaultQueryRowLimit;
 
   public RestApiServiceImpl() {
-    PARTITION_FETCHER = ClusterPartitionFetcher.getInstance();
-    SCHEMA_FETCHER = ClusterSchemaFetcher.getInstance();
+    partitionFetcher = ClusterPartitionFetcher.getInstance();
+    schemaFetcher = ClusterSchemaFetcher.getInstance();
     authorizationHandler = new AuthorizationHandler();
     defaultQueryRowLimit =
         
IoTDBRestServiceDescriptor.getInstance().getConfig().getRestQueryDefaultRowSizeLimit();
@@ -99,8 +99,8 @@ public class RestApiServiceImpl extends RestApiService {
               SESSION_MANAGER.requestQueryId(),
               null,
               sql.getSql(),
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
 
       return Response.ok()
@@ -149,8 +149,8 @@ public class RestApiServiceImpl extends RestApiService {
               queryId,
               null,
               sql.getSql(),
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
           && result.status.code != 
TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
@@ -194,8 +194,8 @@ public class RestApiServiceImpl extends RestApiService {
               SESSION_MANAGER.requestQueryId(),
               null,
               "",
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               config.getQueryTimeoutThreshold());
 
       return Response.ok()
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/InternalServiceThriftHandler.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/InternalServiceThriftHandler.java
index 76068f79ebb..d53d3126502 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/InternalServiceThriftHandler.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/InternalServiceThriftHandler.java
@@ -38,7 +38,9 @@ public class InternalServiceThriftHandler implements 
TServerEventHandler {
   }
 
   @Override
-  public void preServe() {}
+  public void preServe() {
+    // do nothing
+  }
 
   @Override
   public ServerContext createContext(TProtocol tProtocol, TProtocol 
tProtocol1) {
@@ -54,5 +56,7 @@ public class InternalServiceThriftHandler implements 
TServerEventHandler {
 
   @Override
   public void processContext(
-      ServerContext serverContext, TTransport tTransport, TTransport 
tTransport1) {}
+      ServerContext serverContext, TTransport tTransport, TTransport 
tTransport1) {
+    // do nothing
+  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/MLNodeRPCServiceThriftHandler.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/MLNodeRPCServiceThriftHandler.java
index 020a249c6aa..34b165ae682 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/MLNodeRPCServiceThriftHandler.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/handler/MLNodeRPCServiceThriftHandler.java
@@ -48,9 +48,13 @@ public class MLNodeRPCServiceThriftHandler implements 
TServerEventHandler {
   }
 
   @Override
-  public void preServe() {}
+  public void preServe() {
+    // do nothing
+  }
 
   @Override
   public void processContext(
-      ServerContext serverContext, TTransport tTransport, TTransport 
tTransport1) {}
+      ServerContext serverContext, TTransport tTransport, TTransport 
tTransport1) {
+    // do nothing
+  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
index 134d4b7dc41..b35b45fb602 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
@@ -152,10 +152,12 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
 
   private static final SessionManager SESSION_MANAGER = 
SessionManager.getInstance();
 
+  public static final String ERROR_CODE = "error code: ";
+
   private static final TSProtocolVersion CURRENT_RPC_VERSION =
       TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V3;
 
-  private static final boolean enableAuditLog = config.isEnableAuditLog();
+  private static final boolean ENABLE_AUDIT_LOG = config.isEnableAuditLog();
 
   private final IPartitionFetcher partitionFetcher;
 
@@ -221,7 +223,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
           DataNodeThrottleQuotaManager.getInstance()
               .checkQuota(SESSION_MANAGER.getCurrSession().getUsername(), s);
       statementType = s.getType();
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(statement, s);
       }
 
@@ -313,7 +315,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
           DataNodeThrottleQuotaManager.getInstance()
               .checkQuota(SESSION_MANAGER.getCurrSession().getUsername(), s);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("execute Raw Data Query: %s", req), s);
       }
       queryId = SESSION_MANAGER.requestQueryId(clientSession, req.statementId);
@@ -329,7 +331,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
               req.getTimeout());
 
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-        throw new RuntimeException("error code: " + result.status);
+        throw new RuntimeException(ERROR_CODE + result.status);
       }
 
       IQueryExecution queryExecution = COORDINATOR.getQueryExecution(queryId);
@@ -401,7 +403,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
           DataNodeThrottleQuotaManager.getInstance()
               .checkQuota(SESSION_MANAGER.getCurrSession().getUsername(), s);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("Last Data Query: %s", req), s);
       }
       queryId = SESSION_MANAGER.requestQueryId(clientSession, req.statementId);
@@ -417,7 +419,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
               req.getTimeout());
 
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-        throw new RuntimeException("error code: " + result.status);
+        throw new RuntimeException(ERROR_CODE + result.status);
       }
 
       IQueryExecution queryExecution = COORDINATOR.getQueryExecution(queryId);
@@ -504,7 +506,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
               req.getTimeout());
 
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-        throw new RuntimeException("error code: " + result.status);
+        throw new RuntimeException(ERROR_CODE + result.status);
       }
 
       IQueryExecution queryExecution = COORDINATOR.getQueryExecution(queryId);
@@ -753,9 +755,8 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       }
 
       // Step 1: Create SetStorageGroupStatement
-      DatabaseSchemaStatement statement =
-          (DatabaseSchemaStatement) 
StatementGenerator.createStatement(storageGroup);
-      if (enableAuditLog) {
+      DatabaseSchemaStatement statement = 
StatementGenerator.createStatement(storageGroup);
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("create database %s", storageGroup), 
statement);
       }
       // permission check
@@ -796,7 +797,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       
req.setMeasurementAlias(PathUtils.checkAndReturnSingleMeasurement(req.getMeasurementAlias()));
       // Step 1: transfer from TSCreateTimeseriesReq to Statement
       CreateTimeSeriesStatement statement = 
StatementGenerator.createStatement(req);
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("create timeseries %s", req.getPath()), 
statement);
       }
       // permission check
@@ -843,7 +844,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
 
       // Step 1: transfer from CreateAlignedTimeSeriesReq to Statement
       CreateAlignedTimeSeriesStatement statement = 
StatementGenerator.createStatement(req);
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "create aligned timeseries %s.%s", req.getPrefixPath(), 
req.getMeasurements()),
@@ -891,7 +892,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
 
       // Step 1: transfer from CreateMultiTimeSeriesReq to Statement
       CreateMultiTimeSeriesStatement statement = 
StatementGenerator.createStatement(req);
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "create %s timeseries, the first is %s",
@@ -977,7 +978,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       // Step 1: transfer from DeleteStorageGroupsReq to Statement
       DeleteDatabaseStatement statement = 
StatementGenerator.createStatement(storageGroups);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("delete databases: %s", storageGroups), 
statement);
       }
 
@@ -1052,7 +1053,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
               DataNodeThrottleQuotaManager.getInstance()
                   .checkQuota(SESSION_MANAGER.getCurrSession().getUsername(), 
s);
 
-          if (enableAuditLog) {
+          if (ENABLE_AUDIT_LOG) {
             AuditLogger.log(statement, s);
           }
 
@@ -1189,7 +1190,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
         return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
       }
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "insertRecords, first device %s, first time %s",
@@ -1256,7 +1257,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
         return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
       }
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "insertRecords, first device %s, first time %s",
@@ -1325,7 +1326,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
         return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
       }
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "insertRecords, first device %s, first time %s",
@@ -1394,7 +1395,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
         return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
       }
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "insertRecord, device %s, time %s", req.getPrefixPath(), 
req.getTimestamp()),
@@ -1572,7 +1573,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
         return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
       }
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "insertRecords, first device %s, first time %s",
@@ -1731,7 +1732,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       // Step 1: transfer from TSCreateSchemaTemplateReq to Statement
       CreateSchemaTemplateStatement statement = 
StatementGenerator.createStatement(req);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("create schema template %s", 
req.getName()), statement);
       }
       // permission check
@@ -1841,7 +1842,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
           DataNodeThrottleQuotaManager.getInstance()
               .checkQuota(SESSION_MANAGER.getCurrSession().getUsername(), 
statement);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("execute Query: %s", statement), 
statement);
       }
       long queryId = SESSION_MANAGER.requestQueryId();
@@ -1909,7 +1910,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       // Step 1: transfer from TSCreateSchemaTemplateReq to Statement
       SetSchemaTemplateStatement statement = 
StatementGenerator.createStatement(req);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format("set schema template %s.%s", req.getTemplateName(), 
req.getPrefixPath()),
             statement);
@@ -1956,7 +1957,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       // Step 1: transfer from TSCreateSchemaTemplateReq to Statement
       UnsetSchemaTemplateStatement statement = 
StatementGenerator.createStatement(req);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "unset schema template %s from %s", req.getTemplateName(), 
req.getPrefixPath()),
@@ -2004,7 +2005,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       // Step 1: transfer from TSCreateSchemaTemplateReq to Statement
       DropSchemaTemplateStatement statement = 
StatementGenerator.createStatement(req);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(String.format("drop schema template %s", 
req.getTemplateName()), statement);
       }
 
@@ -2047,7 +2048,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
       BatchActivateTemplateStatement statement =
           
StatementGenerator.createBatchActivateTemplateStatement(req.getDevicePathList());
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format("batch activate schema template %s", 
req.getDevicePathList()), statement);
       }
@@ -2130,7 +2131,7 @@ public class ClientRPCServiceImpl implements 
IClientRPCServiceWithHandler {
 
       InsertRowStatement statement = StatementGenerator.createStatement(req);
 
-      if (enableAuditLog) {
+      if (ENABLE_AUDIT_LOG) {
         AuditLogger.log(
             String.format(
                 "insertStringRecord, device %s, time %s", req.getPrefixPath(), 
req.getTimestamp()),
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
index 5918766e204..4559d7a70d8 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java
@@ -240,9 +240,9 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
 
   private static final Coordinator COORDINATOR = Coordinator.getInstance();
 
-  private final IPartitionFetcher PARTITION_FETCHER;
+  private final IPartitionFetcher partitionFetcher;
 
-  private final ISchemaFetcher SCHEMA_FETCHER;
+  private final ISchemaFetcher schemaFetcher;
 
   private final SchemaEngine schemaEngine = SchemaEngine.getInstance();
   private final StorageEngine storageEngine = StorageEngine.getInstance();
@@ -257,8 +257,8 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
 
   public DataNodeInternalRPCServiceImpl() {
     super();
-    PARTITION_FETCHER = ClusterPartitionFetcher.getInstance();
-    SCHEMA_FETCHER = ClusterSchemaFetcher.getInstance();
+    partitionFetcher = ClusterPartitionFetcher.getInstance();
+    schemaFetcher = ClusterSchemaFetcher.getInstance();
   }
 
   @Override
@@ -645,15 +645,17 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
   private Map<PartialPath, List<Integer>> filterTemplateSetInfo(
       Map<PartialPath, List<Integer>> templateSetInfo, TConsensusGroupId 
consensusGroupId) {
 
-    PartialPath storageGroupPath = getStorageGroupPath(consensusGroupId);
-    PartialPath storageGroupPattern = 
storageGroupPath.concatNode(MULTI_LEVEL_PATH_WILDCARD);
     Map<PartialPath, List<Integer>> result = new HashMap<>();
-    templateSetInfo.forEach(
-        (k, v) -> {
-          if (storageGroupPattern.overlapWith(k) || 
storageGroupPath.overlapWith(k)) {
-            result.put(k, v);
-          }
-        });
+    PartialPath storageGroupPath = getStorageGroupPath(consensusGroupId);
+    if (null != storageGroupPath) {
+      PartialPath storageGroupPattern = 
storageGroupPath.concatNode(MULTI_LEVEL_PATH_WILDCARD);
+      templateSetInfo.forEach(
+          (k, v) -> {
+            if (storageGroupPattern.overlapWith(k) || 
storageGroupPath.overlapWith(k)) {
+              result.put(k, v);
+            }
+          });
+    }
     return result;
   }
 
@@ -1025,8 +1027,8 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
               queryId,
               SESSION_MANAGER.getSessionInfo(session),
               executedSQL,
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               req.getTimeout());
 
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
@@ -1074,8 +1076,8 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
               queryId,
               SESSION_MANAGER.getSessionInfo(session),
               "",
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER);
+              partitionFetcher,
+              schemaFetcher);
       return result.status;
     } catch (Exception e) {
       return ErrorHandlingUtils.onQueryException(e, 
OperationType.DELETE_TIMESERIES);
@@ -1187,22 +1189,20 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
       DataRegionConsensusImpl.getInstance()
           .getAllConsensusGroupIds()
           .forEach(
-              groupId -> {
-                result.put(
-                    groupId.convertToTConsensusGroupId(),
-                    DataRegionConsensusImpl.getInstance().isLeader(groupId));
-              });
+              groupId ->
+                  result.put(
+                      groupId.convertToTConsensusGroupId(),
+                      
DataRegionConsensusImpl.getInstance().isLeader(groupId)));
     }
 
     if (SchemaRegionConsensusImpl.getInstance() != null) {
       SchemaRegionConsensusImpl.getInstance()
           .getAllConsensusGroupIds()
           .forEach(
-              groupId -> {
-                result.put(
-                    groupId.convertToTConsensusGroupId(),
-                    SchemaRegionConsensusImpl.getInstance().isLeader(groupId));
-              });
+              groupId ->
+                  result.put(
+                      groupId.convertToTConsensusGroupId(),
+                      
SchemaRegionConsensusImpl.getInstance().isLeader(groupId)));
     }
     return result;
   }
@@ -1814,5 +1814,7 @@ public class DataNodeInternalRPCServiceImpl implements 
IDataNodeRPCService.Iface
     return status;
   }
 
-  public void handleClientExit() {}
+  public void handleClientExit() {
+    // do nothing
+  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeRegionManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeRegionManager.java
index 73c22b59389..b2a6cb4b94d 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeRegionManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeRegionManager.java
@@ -79,10 +79,9 @@ public class DataNodeRegionManager {
     schemaEngine
         .getAllSchemaRegions()
         .forEach(
-            schemaRegion -> {
-              schemaRegionLockMap.put(
-                  schemaRegion.getSchemaRegionId(), new 
ReentrantReadWriteLock(false));
-            });
+            schemaRegion ->
+                schemaRegionLockMap.put(
+                    schemaRegion.getSchemaRegionId(), new 
ReentrantReadWriteLock(false)));
 
     storageEngine
         .getAllDataRegionIds()
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/MLNodeRPCServiceImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/MLNodeRPCServiceImpl.java
index a419394503a..d881124f508 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/MLNodeRPCServiceImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/MLNodeRPCServiceImpl.java
@@ -50,8 +50,6 @@ import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.tsfile.utils.Pair;
 
 import org.apache.thrift.TException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.nio.ByteBuffer;
 import java.util.List;
@@ -61,22 +59,20 @@ public class MLNodeRPCServiceImpl implements 
IMLNodeRPCServiceWithHandler {
 
   public static final String ML_METRICS_PATH_PREFIX = "root.__system.ml.exp";
 
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(MLNodeRPCServiceImpl.class);
-
   private static final SessionManager SESSION_MANAGER = 
SessionManager.getInstance();
 
   private static final Coordinator COORDINATOR = Coordinator.getInstance();
 
-  private final IPartitionFetcher PARTITION_FETCHER;
+  private final IPartitionFetcher partitionFetcher;
 
-  private final ISchemaFetcher SCHEMA_FETCHER;
+  private final ISchemaFetcher schemaFetcher;
 
   private final IClientSession session;
 
   public MLNodeRPCServiceImpl() {
     super();
-    PARTITION_FETCHER = ClusterPartitionFetcher.getInstance();
-    SCHEMA_FETCHER = ClusterSchemaFetcher.getInstance();
+    partitionFetcher = ClusterPartitionFetcher.getInstance();
+    schemaFetcher = ClusterSchemaFetcher.getInstance();
     session = new InternalClientSession("MLNodeService");
     SESSION_MANAGER.registerSession(session);
     SESSION_MANAGER.supplySession(
@@ -100,8 +96,8 @@ public class MLNodeRPCServiceImpl implements 
IMLNodeRPCServiceWithHandler {
               queryId,
               SESSION_MANAGER.getSessionInfo(session),
               "",
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER,
+              partitionFetcher,
+              schemaFetcher,
               req.getTimeout());
 
       if (result.status.code != TSStatusCode.SUCCESS_STATUS.getStatusCode()
@@ -193,8 +189,8 @@ public class MLNodeRPCServiceImpl implements 
IMLNodeRPCServiceWithHandler {
               queryId,
               SESSION_MANAGER.getSessionInfo(session),
               "",
-              PARTITION_FETCHER,
-              SCHEMA_FETCHER);
+              partitionFetcher,
+              schemaFetcher);
       return result.status;
     } catch (Exception e) {
       return ErrorHandlingUtils.onQueryException(e, 
OperationType.INSERT_RECORD);

Reply via email to