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

shuwenwei pushed a commit to branch fixTreeViewScan-0819
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 7002edf4fec6c8f0093133395965df7a0d1636ec
Author: shuwenwei <[email protected]>
AuthorDate: Tue Aug 19 15:16:40 2025 +0800

    support prefix path 'root.**' in tree view scan
---
 .../iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java    | 5 ++++-
 .../db/queryengine/plan/relational/planner/TableLogicalPlanner.java  | 5 ++++-
 .../relational/planner/optimizations/PushPredicateIntoTableScan.java | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
index a27d28d0f30..f522b1036b6 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/TableOperatorGenerator.java
@@ -1028,7 +1028,10 @@ public class TableOperatorGenerator extends 
PlanVisitor<Operator, LocalExecution
     try {
       PartialPath db = new PartialPath(treeDBName);
       int dbLevel = db.getNodes().length;
-      if (dbLevel == 2) {
+      // For the path of 'root.**', we can only get the root level in this 
place
+      // In this case, we still need to support deviceId such as 'root.db'
+      // The relevant deviceId must be two level, but we can't get it now
+      if (dbLevel == 1 || dbLevel == 2) {
         return new TwoLevelDBExtractor(treeDBName.length());
       } else if (dbLevel == 3) {
         return new ThreeLevelDBExtractor(treeDBName.length());
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/TableLogicalPlanner.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/TableLogicalPlanner.java
index 0a5aed8d721..456e4b768d8 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/TableLogicalPlanner.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/TableLogicalPlanner.java
@@ -582,7 +582,10 @@ public class TableLogicalPlanner {
           ClusterPartitionFetcher.getInstance().getSchemaPartition(tree));
 
       if (analysis.getSchemaPartitionInfo().getSchemaPartitionMap().size() > 
1) {
-        throw new SemanticException("Tree device view with multiple databases 
is unsupported yet.");
+        throw new SemanticException(
+            "Tree device view with multiple databases("
+                + 
analysis.getSchemaPartitionInfo().getSchemaPartitionMap().keySet()
+                + ") is unsupported yet.");
       }
     } else {
       analysis.setSchemaPartitionInfo(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
index cfaa4a99f84..8585eb4ebcb 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
@@ -580,7 +580,10 @@ public class PushPredicateIntoTableScan implements 
PlanOptimizer {
               attributeColumns,
               queryContext);
       if (deviceEntriesMap.size() > 1) {
-        throw new SemanticException("Tree device view with multiple databases 
is unsupported yet.");
+        throw new SemanticException(
+            "Tree device view with multiple databases("
+                + deviceEntriesMap.keySet()
+                + ") is unsupported yet.");
       }
       final String deviceDatabase =
           !deviceEntriesMap.isEmpty() ? 
deviceEntriesMap.keySet().iterator().next() : null;

Reply via email to