This is an automated email from the ASF dual-hosted git repository.

jackietien 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 488686adc47 Skip generate distributed plan when treeDBName is null
488686adc47 is described below

commit 488686adc478381c4f15e50c80608bce58a52ff9
Author: shuwenwei <[email protected]>
AuthorDate: Wed Jun 4 11:32:43 2025 +0800

    Skip generate distributed plan when treeDBName is null
---
 .../it/query/view/recent/IoTDBTableViewQueryIT.java          | 12 ++++++++++++
 .../planner/distribute/TableDistributedPlanGenerator.java    |  6 +++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/recent/IoTDBTableViewQueryIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/recent/IoTDBTableViewQueryIT.java
index 17a5cf9ad00..6d2f4d062c6 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/recent/IoTDBTableViewQueryIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/view/recent/IoTDBTableViewQueryIT.java
@@ -339,6 +339,18 @@ public class IoTDBTableViewQueryIT {
       // empty result
       compareQueryResults(
           session, "select * from view3 limit 1", "select * from table1 limit 
0", true);
+
+      // not exists
+      compareQueryResults(
+          session,
+          "select count(*) from view1 where battery = 'b'",
+          "select count(*) from table1 where battery = 'b'",
+          false);
+      compareQueryResults(
+          session,
+          "select * from (select time, battery as device1 from view1 where 
battery = 'b1') as t1 full outer join (select time, battery as device2 from 
view2 where battery = 'b') as t2 using(time)",
+          "select * from (select time, battery as device1 from table1 where 
battery = 'b1') as t1 full outer join (select time, battery as device2 from 
table1 where battery = 'b') as t2 using(time)",
+          true);
     }
   }
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
index d5336c5556a..31526d7c0e6 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java
@@ -778,7 +778,7 @@ public class TableDistributedPlanGenerator
   @Override
   public List<PlanNode> visitTreeDeviceViewScan(TreeDeviceViewScanNode node, 
PlanContext context) {
     DataPartition dataPartition = analysis.getDataPartitionInfo();
-    if (dataPartition == null) {
+    if (dataPartition == null || node.getTreeDBName() == null) {
       node.setRegionReplicaSet(NOT_ASSIGNED);
       return Collections.singletonList(node);
     }
@@ -1025,6 +1025,10 @@ public class TableDistributedPlanGenerator
         node instanceof AggregationTreeDeviceViewScanNode
             ? ((AggregationTreeDeviceViewScanNode) node).getTreeDBName()
             : node.getQualifiedObjectName().getDatabaseName();
+    if (dbName == null) {
+      node.setRegionReplicaSet(NOT_ASSIGNED);
+      return Collections.singletonList(node);
+    }
     DataPartition dataPartition = analysis.getDataPartitionInfo();
     boolean needSplit = false;
     List<List<TRegionReplicaSet>> regionReplicaSetsList = new ArrayList<>();

Reply via email to