diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java index d982f9ba9889..4cf27f21fb92 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java @@ -133,7 +133,12 @@ public List visitSingleDeviceView( String device = node.getDevice(); List regionReplicaSets = - analysis.getPartitionInfo(device, context.getPartitionTimeFilter()); + !analysis.useLogicalView() + ? new ArrayList<>(analysis.getPartitionInfo(device, context.getPartitionTimeFilter())) + : new ArrayList<>( + analysis.getPartitionInfo( + analysis.getOutputDeviceToQueriedDevicesMap().get(device), + context.getPartitionTimeFilter())); List singleDeviceViewList = new ArrayList<>(); for (TRegionReplicaSet tRegionReplicaSet : regionReplicaSets) { @@ -183,7 +188,7 @@ public List visitDeviceView(DeviceViewNode node, DistributionPlanConte String outputDevice = node.getDevices().get(i); PlanNode child = node.getChildren().get(i); List regionReplicaSets = - analysis.isAllDevicesInOneTemplate() + !analysis.useLogicalView() ? new ArrayList<>( analysis.getPartitionInfo(outputDevice, context.getPartitionTimeFilter())) : new ArrayList<>(