change cache method
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/DataNodeQueryContext.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/DataNodeQueryContext.java
index 881ff9d..eddefd9 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/DataNodeQueryContext.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/DataNodeQueryContext.java
@@ -47,8 +47,8 @@
     this.dataNodeFINum = new AtomicInteger(dataNodeFINum);
   }
 
-  public boolean unCached(PartialPath path) {
-    return uncachedPathToSeriesScanInfo.containsKey(path);
+  public boolean hasCached(PartialPath path) {
+    return !uncachedPathToSeriesScanInfo.containsKey(path);
   }
 
   public void addUnCachePath(PartialPath path, AtomicInteger dataNodeSeriesScanNum) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
index 3f70b46..329d040 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
@@ -2819,7 +2819,7 @@
     TimeValuePair timeValuePair = null;
     context.dataNodeQueryContext.lock();
     try {
-      if (!context.dataNodeQueryContext.unCached(seriesPath)) {
+      if (context.dataNodeQueryContext.hasCached(seriesPath)) {
         timeValuePair = DATA_NODE_SCHEMA_CACHE.getLastCache(seriesPath);
         if (timeValuePair == null) {
           context.dataNodeQueryContext.addUnCachePath(seriesPath, node.getDataNodeSeriesScanNum());
@@ -3053,9 +3053,9 @@
       final MeasurementPath measurementPath =
           devicePath.concatAsMeasurementPath(measurementList.get(i));
       TimeValuePair timeValuePair = null;
+      context.dataNodeQueryContext.lock();
       try {
-        context.dataNodeQueryContext.lock();
-        if (!context.dataNodeQueryContext.unCached(measurementPath)) {
+        if (context.dataNodeQueryContext.hasCached(measurementPath)) {
           timeValuePair = DATA_NODE_SCHEMA_CACHE.getLastCache(measurementPath);
           if (timeValuePair == null) {
             context.dataNodeQueryContext.addUnCachePath(