Zhong Wang created IOTDB-2234: --------------------------------- Summary: Last queries cause NPE when last value is not cached Key: IOTDB-2234 URL: https://issues.apache.org/jira/browse/IOTDB-2234 Project: Apache IoTDB Issue Type: Bug Reporter: Zhong Wang
When the last value cache is absent, LastQueryExecutor will pass a MeasurementPath to the storage to get the last value. The MeasurementPath is constructed using the LastValueRequest, which doesn't contain the schema. But the storage engine assumes it does. Thus, an NPE is thrown when the storage engine constructs the ReadOnlyMemChunk using the MeasurementPath. Here's the full stack trace. {code} 2021-12-29 17:59:32,243 [pool-34-IoTDB-ClusterDataRPC-Client-17] ERROR o.a.t.ProcessFunction:47 - Internal error processing last java.lang.NullPointerException: null at org.apache.iotdb.db.metadata.path.MeasurementPath.getReadOnlyMemChunkFromMemTable(MeasurementPath.java:272) at org.apache.iotdb.db.engine.memtable.AbstractMemTable.query(AbstractMemTable.java:370) at org.apache.iotdb.db.engine.storagegroup.TsFileProcessor.query(TsFileProcessor.java:1259) at org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor.getFileResourceListForQuery(StorageGroupProcessor.java:1869) at org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor.query(StorageGroupProcessor.java:1758) at org.apache.iotdb.db.engine.StorageEngine.query(StorageEngine.java:763) at org.apache.iotdb.db.query.control.QueryResourceManager.getQueryDataSource(QueryResourceManager.java:95) at org.apache.iotdb.db.query.executor.LastQueryExecutor.calculateLastPairForSeriesLocally(LastQueryExecutor.java:171) at org.apache.iotdb.cluster.query.LocalQueryExecutor.last(LocalQueryExecutor.java:1045) at org.apache.iotdb.cluster.server.service.DataSyncService.last(DataSyncService.java:413) at org.apache.iotdb.cluster.server.service.DataGroupServiceImpls.last(DataGroupServiceImpls.java:620) at org.apache.iotdb.cluster.rpc.thrift.TSDataService$Processor$last.getResult(TSDataService.java:2515) at org.apache.iotdb.cluster.rpc.thrift.TSDataService$Processor$last.getResult(TSDataService.java:2495) at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:38) at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:38) at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:248) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) {code} -- This message was sent by Atlassian Jira (v8.20.1#820001)