You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/07/20 06:01:10 UTC

[iotdb] branch master updated: Fix aligned last query

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

jackietien 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 e33da6b82dd Fix aligned last query
e33da6b82dd is described below

commit e33da6b82dde72c6922141c625a0dbf5279224fc
Author: Weihao Li <60...@users.noreply.github.com>
AuthorDate: Thu Jul 20 14:01:04 2023 +0800

    Fix aligned last query
---
 .../apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java   | 11 +++++++++++
 .../apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java    |  7 +++++++
 .../db/queryengine/plan/planner/OperatorTreeGenerator.java    |  3 ++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java
index 7a74cc12920..d8a04e08f19 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aligned/IoTDBAlignedLastQueryIT.java
@@ -329,4 +329,15 @@ public class IoTDBAlignedLastQueryIT {
       fail(e.getMessage());
     }
   }
+
+  @Test
+  public void cacheHitTest() {
+    selectAllAlignedLastTest();
+    selectAllAlignedAndNonAlignedLastTest();
+    selectSomeAlignedAndNonAlignedLastWithTimeFilterTest();
+    selectSomeAlignedLastTest1();
+    selectSomeAlignedLastTest2();
+    selectSomeAlignedLastWithTimeFilterTest();
+    selectSomeAlignedAndNonAlignedLastWithTimeFilterTest();
+  }
 }
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java
index 88afd996edf..33f9ef9e151 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/last/IoTDBLastQueryLastCacheIT.java
@@ -157,4 +157,11 @@ public class IoTDBLastQueryLastCacheIT {
         };
     resultSetEqualTest("select last * from root.sg;", expectedHeader, retArray);
   }
+
+  @Test
+  public void cacheHitTest() {
+    testLastQuery();
+    testLastQueryOrderByTimeDesc();
+    testLastQuery1();
+  }
 }
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 66747e40685..4dfec56a44e 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
@@ -235,6 +235,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
 import static com.google.common.base.Preconditions.checkArgument;
@@ -2216,7 +2217,7 @@ public class OperatorTreeGenerator extends PlanVisitor<Operator, LocalExecutionP
           timeValuePair = DATA_NODE_SCHEMA_CACHE.getLastCache(measurementPath);
           if (timeValuePair == null) {
             context.dataNodeQueryContext.addUnCachePath(
-                measurementPath, node.getDataNodeSeriesScanNum());
+                measurementPath, new AtomicInteger(node.getDataNodeSeriesScanNum().get()));
           }
         }
       } finally {