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

shuwenwei pushed a commit to branch fixLastQueryBug-0123
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 6737702c648f7dcd2650721607311fcc22db7597
Author: shuwenwei <[email protected]>
AuthorDate: Fri Jan 23 18:27:39 2026 +0800

    add it
---
 .../db/it/last/IoTDBLastQueryLastCacheIT.java      | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

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 1c69857a3c5..3eedf1540eb 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
@@ -192,4 +192,46 @@ public class IoTDBLastQueryLastCacheIT {
         };
     resultSetEqualTest("select last s1 from root.sg.d1;", expectedHeader, 
retArray);
   }
+
+  @Test
+  public void testNonAlignedLastQueryWithTimeFilterWithoutCache() throws 
SQLException {
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      statement.execute("insert into root.db1.g1.d3(time,s_3) values (1,1)");
+      statement.execute("insert into root.db1.g1.d3(time,s_3) values (2,2)");
+      statement.execute("insert into root.db1.g1.d3(time,s_3) values (3,3)");
+      statement.execute("insert into root.db1.g1.d3(time,s_3) values (4,4)");
+      statement.execute("insert into root.db1.g1.d3(time,s_1) values (1,1)");
+      statement.execute("insert into root.db1.g1.d3(time,s_1) values (2,2)");
+    }
+    String[] expectedHeader =
+        new String[] {TIMESTAMP_STR, TIMESERIES_STR, VALUE_STR, DATA_TYPE_STR};
+    String[] retArray =
+        new String[] {
+          "4,root.db1.g1.d3.s_3,4.0,DOUBLE,",
+        };
+    resultSetEqualTest(
+        "select last s_1, s_3 from root.db1.g1.d3 where time > 2;", 
expectedHeader, retArray);
+  }
+
+  @Test
+  public void testAlignedLastQueryWithTimeFilterWithoutCache() throws 
SQLException {
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      statement.execute("insert into root.db1.g1.d4(time,s_3) aligned values 
(1,1)");
+      statement.execute("insert into root.db1.g1.d4(time,s_3) aligned values 
(2,2)");
+      statement.execute("insert into root.db1.g1.d4(time,s_3) aligned values 
(3,3)");
+      statement.execute("insert into root.db1.g1.d4(time,s_3) aligned values 
(4,4)");
+      statement.execute("insert into root.db1.g1.d4(time,s_1) aligned values 
(1,1)");
+      statement.execute("insert into root.db1.g1.d4(time,s_1) aligned values 
(2,2)");
+    }
+    String[] expectedHeader =
+        new String[] {TIMESTAMP_STR, TIMESERIES_STR, VALUE_STR, DATA_TYPE_STR};
+    String[] retArray =
+        new String[] {
+          "4,root.db1.g1.d4.s_3,4.0,DOUBLE,",
+        };
+    resultSetEqualTest(
+        "select last s_1, s_3 from root.db1.g1.d4 where time > 2;", 
expectedHeader, retArray);
+  }
 }

Reply via email to