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 8289238b119 Fix init time logic to ensure that time is not initiated‌ 
when the last cache will not updated during the execution phase (#17094)
8289238b119 is described below

commit 8289238b119187343645bcfe560709f65949ef29
Author: Weihao Li <[email protected]>
AuthorDate: Wed Jan 28 14:21:14 2026 +0800

    Fix init time logic to ensure that time is not initiated‌ when the last 
cache will not updated during the execution phase (#17094)
---
 .../relational/it/query/recent/IoTDBTableAggregationIT.java      | 9 +++++++++
 .../db/queryengine/plan/planner/TableOperatorGenerator.java      | 6 +++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
index 88367283eb7..df6ed279ea0 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java
@@ -2498,6 +2498,15 @@ public class IoTDBTableAggregationIT {
         DATABASE_NAME,
         2);
 
+    expectedHeader = new String[] {"device_id", "_col1"};
+    retArray = new String[] {"d01,0xcafebabe55,", "d02,0xcafebabe50,"};
+    repeatTest(
+        "select device_id, last(s8) from table1 where device_id = 'd01' or 
device_id = 'd02' group by device_id order by device_id",
+        expectedHeader,
+        retArray,
+        DATABASE_NAME,
+        2);
+
     expectedHeader =
         new String[] {
           "_col0", "_col1", "_col2", "_col3", "_col4", "_col5", "_col6", 
"_col7", "_col8", "_col9",
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
index 9c8dade73a8..62e46d4598e 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
@@ -3247,9 +3247,9 @@ public class TableOperatorGenerator extends 
PlanVisitor<Operator, LocalExecution
               .initOrInvalidateLastCache(
                   node.getQualifiedObjectName().getDatabaseName(),
                   deviceEntry.getDeviceID(),
-                  needInitTime && node.getGroupingKeys().isEmpty()
-                      ? Arrays.copyOfRange(targetColumns, 0, 
targetColumns.length - 1)
-                      : targetColumns,
+                  needInitTime || node.getGroupingKeys().isEmpty()
+                      ? targetColumns
+                      : Arrays.copyOfRange(targetColumns, 0, 
targetColumns.length - 1),
                   false);
         } else {
           hitCachesIndexes.add(i);

Reply via email to