This is an automated email from the ASF dual-hosted git repository.
caogaofei 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 6145474ac45 Fix the usage of method initOrInvalidateLastCache in table
last query process. (#15300)
6145474ac45 is described below
commit 6145474ac45f1caf492d10583da70af9ff7f1691
Author: Beyyes <[email protected]>
AuthorDate: Wed Apr 9 10:55:27 2025 +0800
Fix the usage of method initOrInvalidateLastCache in table last query
process. (#15300)
---
.../relational/LastQueryAggTableScanOperator.java | 2 --
.../plan/planner/TableOperatorGenerator.java | 18 ++++++++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/LastQueryAggTableScanOperator.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/LastQueryAggTableScanOperator.java
index dd1dac4e652..63b2d196590 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/LastQueryAggTableScanOperator.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/LastQueryAggTableScanOperator.java
@@ -352,8 +352,6 @@ public class LastQueryAggTableScanOperator extends
AbstractAggTableScanOperator
TimeValuePair[] updateTimeValuePairArray =
updateTimeValuePairList.toArray(new TimeValuePair[0]);
currentDeviceEntry = deviceEntries.get(currentDeviceIndex);
- TABLE_DEVICE_SCHEMA_CACHE.initOrInvalidateLastCache(
- dbName, currentDeviceEntry.getDeviceID(), updateMeasurementArray,
false);
TABLE_DEVICE_SCHEMA_CACHE.updateLastCacheIfExists(
dbName,
currentDeviceEntry.getDeviceID(),
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 572e79a3adf..fd54b3135a1 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
@@ -2335,14 +2335,28 @@ public class TableOperatorGenerator extends
PlanVisitor<Operator, LocalExecution
}
if (!allHitCache) {
+ DeviceEntry deviceEntry = node.getDeviceEntries().get(i);
AlignedFullPath alignedPath =
constructAlignedPath(
- node.getDeviceEntries().get(i),
+ deviceEntry,
parameter.getMeasurementColumnNames(),
parameter.getMeasurementSchemas(),
parameter.getAllSensors());
((DataDriverContext) context.getDriverContext()).addPath(alignedPath);
- unCachedDeviceEntries.add(node.getDeviceEntries().get(i));
+ unCachedDeviceEntries.add(deviceEntry);
+
+ // last cache updateColumns need put "" as time column
+ String[] updateColumns = new
String[parameter.getMeasurementColumnNames().size() + 1];
+ updateColumns[0] = "";
+ for (int j = 1; j < updateColumns.length; j++) {
+ updateColumns[j] = parameter.getMeasurementColumnNames().get(j - 1);
+ }
+ TableDeviceSchemaCache.getInstance()
+ .initOrInvalidateLastCache(
+ node.getQualifiedObjectName().getDatabaseName(),
+ deviceEntry.getDeviceID(),
+ updateColumns,
+ false);
} else {
hitCachesIndexes.add(i);
hitCachedResults.add(lastByResult.get());