Skip to content

Commit 7b9d99a

Browse files
committed
filter
1 parent 3c734a5 commit 7b9d99a

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/v2/impl/RestApiServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ public Response executeFastLastQueryStatement(
111111
new PartialPath(prefixPathList.getPrefixPaths().toArray(new String[0]));
112112
Map<PartialPath, Map<String, TimeValuePair>> resultMap = new HashMap<>();
113113

114+
final String prefixString = prefixPath.toString();
114115
for (ISchemaRegion region : SchemaEngine.getInstance().getAllSchemaRegions()) {
116+
if (!prefixString.startsWith(region.getDatabaseFullPath())
117+
&& !region.getDatabaseFullPath().startsWith(prefixString)) {
118+
continue;
119+
}
115120
region.fillLastQueryMap(prefixPath, resultMap);
116121
}
117122
// Check cache first

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,12 @@ public TSExecuteStatementResp executeFastLastDataQueryForOnePrefixPath(
819819
final Map<PartialPath, Map<String, TimeValuePair>> resultMap = new HashMap<>();
820820
int sensorNum = 0;
821821

822+
final String prefixString = prefixPath.toString();
822823
for (final ISchemaRegion region : SchemaEngine.getInstance().getAllSchemaRegions()) {
823-
// Do not filter by database, since we assume all the regions match the prefix path
824+
if (!prefixString.startsWith(region.getDatabaseFullPath())
825+
&& !region.getDatabaseFullPath().startsWith(prefixString)) {
826+
continue;
827+
}
824828
sensorNum += region.fillLastQueryMap(prefixPath, resultMap);
825829
}
826830

0 commit comments

Comments
 (0)