Skip to content

Commit 3f35dc9

Browse files
committed
Fix fast last empty cache handling
1 parent c1bbbd1 commit 3f35dc9

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v2/impl/RestApiServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.apache.iotdb.db.queryengine.plan.execution.ExecutionResult;
3535
import org.apache.iotdb.db.queryengine.plan.execution.IQueryExecution;
3636
import org.apache.iotdb.db.queryengine.plan.parser.StatementGenerator;
37+
import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TableDeviceLastCache;
3738
import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TableDeviceSchemaCache;
3839
import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TableId;
3940
import org.apache.iotdb.db.queryengine.plan.statement.Statement;
@@ -196,6 +197,10 @@ public Response executeFastLastQueryStatement(
196197
for (final Map.Entry<String, Pair<TSDataType, TimeValuePair>> measurementLastEntry :
197198
device2MeasurementLastEntry.getValue().entrySet()) {
198199
final TimeValuePair tvPair = measurementLastEntry.getValue().getRight();
200+
if (tvPair == TableDeviceLastCache.PLACEHOLDER_EMPTY_COLUMN
201+
|| tvPair.getValue() == null) {
202+
continue;
203+
}
199204
valueList.add(tvPair.getValue().getStringValue());
200205
dataTypeList.add(tvPair.getValue().getDataType().name());
201206
targetDataSet.addTimestampsItem(tvPair.getTimestamp());

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,8 @@ public TSExecuteStatementResp executeFastLastDataQueryForOneDeviceV2(
13991399
if (timeValuePair == null) {
14001400
allCached = false;
14011401
break;
1402-
} else if (timeValuePair.getValue() == null) {
1402+
} else if (timeValuePair == TableDeviceLastCache.PLACEHOLDER_EMPTY_COLUMN
1403+
|| timeValuePair.getValue() == null) {
14031404
// there is no data for this sensor
14041405
if (!canUseNullEntry) {
14051406
allCached = false;

0 commit comments

Comments
 (0)