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

hui pushed a commit to branch lmh/PathPatternTreeOpt
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit e0bfb6fda0da864894d12974b774a425077008a6
Author: Minghui Liu <[email protected]>
AuthorDate: Wed Jun 15 12:38:53 2022 +0800

    remove constructor in PathPatternTree
---
 .../thrift/ConfigNodeRPCServiceProcessorTest.java  |  2 +-
 .../db/mpp/common/schematree/PathPatternTree.java  | 74 ++++++-----------
 .../apache/iotdb/db/mpp/plan/analyze/Analyzer.java | 94 ++++++++++++----------
 .../db/mpp/plan/analyze/ClusterSchemaFetcher.java  | 13 ++-
 .../db/mpp/plan/analyze/ExpressionAnalyzer.java    |  6 +-
 .../mpp/plan/analyze/StandaloneSchemaFetcher.java  | 12 ++-
 .../mpp/common/schematree/PathPatternTreeTest.java |  6 +-
 .../schema/SchemaFetchScanOperatorTest.java        |  4 +-
 .../metadata/read/SchemaFetchScanNodeTest.java     |  7 +-
 9 files changed, 108 insertions(+), 110 deletions(-)

diff --git 
a/confignode/src/test/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessorTest.java
 
b/confignode/src/test/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessorTest.java
index 1b9cbb8357..173ca7d0fc 100644
--- 
a/confignode/src/test/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessorTest.java
+++ 
b/confignode/src/test/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessorTest.java
@@ -342,7 +342,7 @@ public class ConfigNodeRPCServiceProcessorTest {
       throws IllegalPathException, IOException {
     PathPatternTree patternTree = new PathPatternTree();
     for (String path : paths) {
-      patternTree.appendPath(new PartialPath(path));
+      patternTree.appendPathPattern(new PartialPath(path));
     }
     patternTree.constructTree();
 
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTree.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTree.java
index 84047dd825..2fb3219d8c 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTree.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTree.java
@@ -32,11 +32,9 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Deque;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 
 public class PathPatternTree {
@@ -45,45 +43,6 @@ public class PathPatternTree {
 
   private List<PartialPath> pathList;
 
-  public PathPatternTree(PathPatternNode root) {
-    this.root = root;
-    this.pathList = new ArrayList<>();
-  }
-
-  public PathPatternTree(PartialPath devicePath, String[] measurements) {
-    this.root = new PathPatternNode(SQLConstant.ROOT);
-    this.pathList = new ArrayList<>();
-    appendPaths(devicePath, Arrays.asList(measurements));
-  }
-
-  public PathPatternTree(PartialPath devicePath, List<String> measurements) {
-    this.root = new PathPatternNode(SQLConstant.ROOT);
-    this.pathList = new ArrayList<>();
-    appendPaths(devicePath, measurements);
-  }
-
-  public PathPatternTree(Map<PartialPath, List<String>> 
deviceToMeasurementsMap) {
-    this.root = new PathPatternNode(SQLConstant.ROOT);
-    this.pathList = new ArrayList<>();
-    for (Map.Entry<PartialPath, List<String>> entry : 
deviceToMeasurementsMap.entrySet()) {
-      appendPaths(entry.getKey(), entry.getValue());
-    }
-  }
-
-  public PathPatternTree(List<PartialPath> pathList) {
-    this.root = new PathPatternNode(SQLConstant.ROOT);
-    this.pathList = new ArrayList<>();
-    for (PartialPath path : pathList) {
-      appendPath(path);
-    }
-  }
-
-  public PathPatternTree(PartialPath fullPath) {
-    this.root = new PathPatternNode(SQLConstant.ROOT);
-    this.pathList = new ArrayList<>();
-    appendPath(fullPath);
-  }
-
   public PathPatternTree() {
     this.root = new PathPatternNode(SQLConstant.ROOT);
     this.pathList = new ArrayList<>();
@@ -97,6 +56,19 @@ public class PathPatternTree {
     this.root = root;
   }
 
+  public void appendFullPath(PartialPath fullPath) {
+    searchAndConstruct(root, fullPath.getNodes(), 0);
+  }
+
+  public void appendFullPath(PartialPath devicePath, String measurement) {
+    int deviceNodeLength = devicePath.getNodeLength();
+    String[] pathNodes = new String[deviceNodeLength + 1];
+    System.arraycopy(devicePath.getNodes(), 0, pathNodes, 0, deviceNodeLength);
+    pathNodes[deviceNodeLength] = measurement;
+
+    searchAndConstruct(root, pathNodes, 0);
+  }
+
   /** @return all device path patterns in the path pattern tree. */
   public List<String> findAllDevicePaths() {
     List<String> nodes = new ArrayList<>();
@@ -137,10 +109,10 @@ public class PathPatternTree {
   }
 
   // append path to pathList
-  public void appendPath(PartialPath newPath) {
+  public void appendPathPattern(PartialPath pathPattern) {
     boolean isExist = false;
     for (PartialPath path : pathList) {
-      if (path.matchFullPath(newPath)) {
+      if (path.matchFullPath(pathPattern)) {
         // path already exists in pathList
         isExist = true;
         break;
@@ -149,15 +121,15 @@ public class PathPatternTree {
     if (!isExist) {
       // remove duplicate path in pathList
       pathList.removeAll(
-          
pathList.stream().filter(newPath::matchFullPath).collect(Collectors.toList()));
-      pathList.add(newPath);
+          
pathList.stream().filter(pathPattern::matchFullPath).collect(Collectors.toList()));
+      pathList.add(pathPattern);
     }
   }
 
   public void appendPaths(PartialPath device, List<String> 
measurementNameList) {
     try {
       for (String measurementName : measurementNameList) {
-        appendPath(new PartialPath(device.getFullPath(), measurementName));
+        appendPathPattern(new PartialPath(device.getFullPath(), 
measurementName));
       }
     } catch (IllegalPathException e) {
       e.printStackTrace();
@@ -211,7 +183,9 @@ public class PathPatternTree {
 
   public static PathPatternTree deserialize(ByteBuffer buffer) {
     PathPatternNode root = deserializeNode(buffer);
-    return new PathPatternTree(root);
+    PathPatternTree deserializedPatternTree = new PathPatternTree();
+    deserializedPatternTree.setRoot(root);
+    return deserializedPatternTree;
   }
 
   private static PathPatternNode deserializeNode(ByteBuffer buffer) {
@@ -257,7 +231,11 @@ public class PathPatternTree {
   }
 
   public PathPatternTree findOverlappedPattern(PartialPath pattern) {
-    return new PathPatternTree(findOverlappedPaths(pattern));
+    PathPatternTree patternTree = new PathPatternTree();
+    for (PartialPath pathPattern : findOverlappedPaths(pattern)) {
+      patternTree.appendPathPattern(pathPattern);
+    }
+    return patternTree;
   }
 
   public List<PartialPath> findOverlappedPaths(PartialPath pattern) {
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analyzer.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analyzer.java
index 834ee25932..35dfb25fd1 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analyzer.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analyzer.java
@@ -940,9 +940,10 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(createTimeSeriesStatement);
 
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendFullPath(createTimeSeriesStatement.getPath());
       SchemaPartition schemaPartitionInfo =
-          partitionFetcher.getOrCreateSchemaPartition(
-              new PathPatternTree(createTimeSeriesStatement.getPath()));
+          partitionFetcher.getOrCreateSchemaPartition(patternTree);
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       return analysis;
     }
@@ -962,12 +963,14 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(createAlignedTimeSeriesStatement);
 
+      PathPatternTree pathPatternTree = new PathPatternTree();
+      for (String measurement : 
createAlignedTimeSeriesStatement.getMeasurements()) {
+        pathPatternTree.appendFullPath(
+            createAlignedTimeSeriesStatement.getDevicePath(), measurement);
+      }
+
       SchemaPartition schemaPartitionInfo;
-      schemaPartitionInfo =
-          partitionFetcher.getOrCreateSchemaPartition(
-              new PathPatternTree(
-                  createAlignedTimeSeriesStatement.getDevicePath(),
-                  createAlignedTimeSeriesStatement.getMeasurements()));
+      schemaPartitionInfo = 
partitionFetcher.getOrCreateSchemaPartition(pathPatternTree);
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       return analysis;
     }
@@ -981,12 +984,14 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(createTimeSeriesByDeviceStatement);
 
+      PathPatternTree pathPatternTree = new PathPatternTree();
+      for (String measurement : 
createTimeSeriesByDeviceStatement.getMeasurements()) {
+        pathPatternTree.appendFullPath(
+            createTimeSeriesByDeviceStatement.getDevicePath(), measurement);
+      }
+
       SchemaPartition schemaPartitionInfo;
-      schemaPartitionInfo =
-          partitionFetcher.getOrCreateSchemaPartition(
-              new PathPatternTree(
-                  createTimeSeriesByDeviceStatement.getDevicePath(),
-                  createTimeSeriesByDeviceStatement.getMeasurements()));
+      schemaPartitionInfo = 
partitionFetcher.getOrCreateSchemaPartition(pathPatternTree);
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       return analysis;
     }
@@ -998,9 +1003,12 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(createMultiTimeSeriesStatement);
 
+      PathPatternTree patternTree = new PathPatternTree();
+      for (PartialPath path : createMultiTimeSeriesStatement.getPaths()) {
+        patternTree.appendFullPath(path);
+      }
       SchemaPartition schemaPartitionInfo =
-          partitionFetcher.getOrCreateSchemaPartition(
-              new PathPatternTree(createMultiTimeSeriesStatement.getPaths()));
+          partitionFetcher.getOrCreateSchemaPartition(patternTree);
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       return analysis;
     }
@@ -1012,10 +1020,10 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(alterTimeSeriesStatement);
 
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendFullPath(alterTimeSeriesStatement.getPath());
       SchemaPartition schemaPartitionInfo;
-      schemaPartitionInfo =
-          partitionFetcher.getSchemaPartition(
-              new PathPatternTree(alterTimeSeriesStatement.getPath()));
+      schemaPartitionInfo = partitionFetcher.getSchemaPartition(patternTree);
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       return analysis;
     }
@@ -1138,13 +1146,12 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(showTimeSeriesStatement);
 
-      SchemaPartition schemaPartitionInfo =
-          partitionFetcher.getSchemaPartition(
-              new PathPatternTree(showTimeSeriesStatement.getPathPattern()));
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendPathPattern(showTimeSeriesStatement.getPathPattern());
+      SchemaPartition schemaPartitionInfo = 
partitionFetcher.getSchemaPartition(patternTree);
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
 
       if (showTimeSeriesStatement.isOrderByHeat()) {
-        PathPatternTree patternTree = new 
PathPatternTree(showTimeSeriesStatement.getPathPattern());
         patternTree.constructTree();
         // request schema fetch API
         logger.info("{} fetch query schema...", getLogHeader());
@@ -1200,12 +1207,10 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(showDevicesStatement);
 
-      SchemaPartition schemaPartitionInfo =
-          partitionFetcher.getSchemaPartition(
-              new PathPatternTree(
-                  showDevicesStatement
-                      .getPathPattern()
-                      .concatNode(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)));
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendPathPattern(
+          
showDevicesStatement.getPathPattern().concatNode(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD));
+      SchemaPartition schemaPartitionInfo = 
partitionFetcher.getSchemaPartition(patternTree);
 
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       analysis.setRespDatasetHeader(
@@ -1248,12 +1253,10 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(countDevicesStatement);
 
-      SchemaPartition schemaPartitionInfo =
-          partitionFetcher.getSchemaPartition(
-              new PathPatternTree(
-                  countDevicesStatement
-                      .getPartialPath()
-                      .concatNode(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD)));
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendPathPattern(
+          
countDevicesStatement.getPartialPath().concatNode(IoTDBConstant.ONE_LEVEL_PATH_WILDCARD));
+      SchemaPartition schemaPartitionInfo = 
partitionFetcher.getSchemaPartition(patternTree);
 
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       analysis.setRespDatasetHeader(HeaderConstant.countDevicesHeader);
@@ -1266,9 +1269,9 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(countTimeSeriesStatement);
 
-      SchemaPartition schemaPartitionInfo =
-          partitionFetcher.getSchemaPartition(
-              new PathPatternTree(countTimeSeriesStatement.getPartialPath()));
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendPathPattern(countTimeSeriesStatement.getPartialPath());
+      SchemaPartition schemaPartitionInfo = 
partitionFetcher.getSchemaPartition(patternTree);
 
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       analysis.setRespDatasetHeader(HeaderConstant.countTimeSeriesHeader);
@@ -1281,9 +1284,9 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(countLevelTimeSeriesStatement);
 
-      SchemaPartition schemaPartitionInfo =
-          partitionFetcher.getSchemaPartition(
-              new 
PathPatternTree(countLevelTimeSeriesStatement.getPartialPath()));
+      PathPatternTree patternTree = new PathPatternTree();
+      
patternTree.appendPathPattern(countLevelTimeSeriesStatement.getPartialPath());
+      SchemaPartition schemaPartitionInfo = 
partitionFetcher.getSchemaPartition(patternTree);
 
       analysis.setSchemaPartitionInfo(schemaPartitionInfo);
       analysis.setRespDatasetHeader(HeaderConstant.countLevelTimeSeriesHeader);
@@ -1295,9 +1298,11 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(countStatement);
 
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendPathPattern(countStatement.getPartialPath());
       SchemaNodeManagementPartition schemaNodeManagementPartition =
           partitionFetcher.getSchemaNodeManagementPartitionWithLevel(
-              new PathPatternTree(countStatement.getPartialPath()), 
countStatement.getLevel());
+              patternTree, countStatement.getLevel());
 
       if (schemaNodeManagementPartition == null) {
         return analysis;
@@ -1336,8 +1341,10 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(statement);
 
+      PathPatternTree patternTree = new PathPatternTree();
+      patternTree.appendPathPattern(path);
       SchemaNodeManagementPartition schemaNodeManagementPartition =
-          partitionFetcher.getSchemaNodeManagementPartition(new 
PathPatternTree(path));
+          partitionFetcher.getSchemaNodeManagementPartition(patternTree);
 
       if (schemaNodeManagementPartition == null) {
         return analysis;
@@ -1360,7 +1367,10 @@ public class Analyzer {
       Analysis analysis = new Analysis();
       analysis.setStatement(deleteDataStatement);
 
-      PathPatternTree patternTree = new 
PathPatternTree(deleteDataStatement.getPathList());
+      PathPatternTree patternTree = new PathPatternTree();
+      for (PartialPath pathPattern : deleteDataStatement.getPathList()) {
+        patternTree.appendPathPattern(pathPattern);
+      }
 
       SchemaPartition schemaPartition = 
partitionFetcher.getSchemaPartition(patternTree);
 
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterSchemaFetcher.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterSchemaFetcher.java
index d5e41a50b7..431b820d7c 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterSchemaFetcher.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterSchemaFetcher.java
@@ -139,8 +139,10 @@ public class ClusterSchemaFetcher implements 
ISchemaFetcher {
     Pair<List<String>, List<TSDataType>> missingMeasurements =
         checkMissingMeasurements(schemaTree, devicePath, measurements, 
tsDataTypes);
 
-    PathPatternTree patternTree =
-        new PathPatternTree(devicePath, missingMeasurements.left.toArray(new 
String[0]));
+    PathPatternTree patternTree = new PathPatternTree();
+    for (String measurement : missingMeasurements.left) {
+      patternTree.appendFullPath(devicePath, measurement);
+    }
 
     if (patternTree.isEmpty()) {
       return schemaTree;
@@ -248,8 +250,11 @@ public class ClusterSchemaFetcher implements 
ISchemaFetcher {
     internalCreateTimeseries(
         devicePath, missingMeasurements, dataTypesOfMissingMeasurement, 
isAligned);
 
-    SchemaTree reFetchSchemaTree =
-        fetchSchema(new PathPatternTree(devicePath, missingMeasurements));
+    PathPatternTree patternTree = new PathPatternTree();
+    for (String measurement : missingMeasurements) {
+      patternTree.appendFullPath(devicePath, measurement);
+    }
+    SchemaTree reFetchSchemaTree = fetchSchema(patternTree);
 
     Pair<List<String>, List<TSDataType>> recheckResult =
         checkMissingMeasurements(
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java
index 14ebea0add..0259fa5479 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ExpressionAnalyzer.java
@@ -192,7 +192,7 @@ public class ExpressionAnalyzer {
       } else {
         for (PartialPath prefixPath : prefixPaths) {
           PartialPath concatPath = prefixPath.concatPath(rawPath);
-          patternTree.appendPath(concatPath);
+          patternTree.appendPathPattern(concatPath);
           actualPaths.add(concatPath);
         }
       }
@@ -232,12 +232,12 @@ public class ExpressionAnalyzer {
     } else if (predicate instanceof TimeSeriesOperand) {
       PartialPath rawPath = ((TimeSeriesOperand) predicate).getPath();
       if (rawPath.getFullPath().startsWith(SQLConstant.ROOT + 
TsFileConstant.PATH_SEPARATOR)) {
-        patternTree.appendPath(rawPath);
+        patternTree.appendPathPattern(rawPath);
         return;
       }
       for (PartialPath prefixPath : prefixPaths) {
         PartialPath concatPath = prefixPath.concatPath(rawPath);
-        patternTree.appendPath(concatPath);
+        patternTree.appendPathPattern(concatPath);
       }
     } else if (predicate instanceof TimestampOperand || predicate instanceof 
ConstantOperand) {
       // do nothing
diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java
index 599d608a80..ca361d5bf9 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/StandaloneSchemaFetcher.java
@@ -115,7 +115,10 @@ public class StandaloneSchemaFetcher implements 
ISchemaFetcher {
       PartialPath devicePath, String[] measurements, TSDataType[] tsDataTypes, 
boolean aligned) {
     SchemaTree schemaTree = new SchemaTree();
 
-    PathPatternTree patternTree = new PathPatternTree(devicePath, 
measurements);
+    PathPatternTree patternTree = new PathPatternTree();
+    for (String measurement : measurements) {
+      patternTree.appendFullPath(devicePath, measurement);
+    }
 
     if (patternTree.isEmpty()) {
       return schemaTree;
@@ -229,8 +232,11 @@ public class StandaloneSchemaFetcher implements 
ISchemaFetcher {
     internalCreateTimeseries(
         devicePath, missingMeasurements, dataTypesOfMissingMeasurement, 
isAligned);
 
-    SchemaTree reFetchSchemaTree =
-        fetchSchema(new PathPatternTree(devicePath, missingMeasurements));
+    PathPatternTree patternTree = new PathPatternTree();
+    for (String measurement : missingMeasurements) {
+      patternTree.appendFullPath(devicePath, measurement);
+    }
+    SchemaTree reFetchSchemaTree = fetchSchema(patternTree);
 
     Pair<List<String>, List<TSDataType>> recheckResult =
         checkMissingMeasurements(
diff --git 
a/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTreeTest.java
 
b/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTreeTest.java
index 16b93e2247..ec9c52f550 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTreeTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/mpp/common/schematree/PathPatternTreeTest.java
@@ -143,13 +143,13 @@ public class PathPatternTreeTest {
       throws IOException {
     PathPatternTree patternTree = new PathPatternTree();
     for (PartialPath path : paths) {
-      patternTree.appendPath(path);
+      patternTree.appendPathPattern(path);
     }
     patternTree.constructTree();
 
     PathPatternTree resultPatternTree = new PathPatternTree();
     for (PartialPath path : compressedPaths) {
-      resultPatternTree.appendPath(path);
+      resultPatternTree.appendPathPattern(path);
     }
     resultPatternTree.constructTree();
 
@@ -182,7 +182,7 @@ public class PathPatternTreeTest {
 
     PathPatternTree patternTree = new PathPatternTree();
     for (PartialPath path : partialPathList) {
-      patternTree.appendPath(path);
+      patternTree.appendPathPattern(path);
     }
     patternTree.constructTree();
 
diff --git 
a/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/schema/SchemaFetchScanOperatorTest.java
 
b/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/schema/SchemaFetchScanOperatorTest.java
index 4b204bdd70..dd76bf4631 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/schema/SchemaFetchScanOperatorTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/mpp/execution/operator/schema/SchemaFetchScanOperatorTest.java
@@ -66,8 +66,8 @@ public class SchemaFetchScanOperatorTest {
     ISchemaRegion schemaRegion = prepareSchemaRegion();
 
     PathPatternTree patternTree = new PathPatternTree();
-    patternTree.appendPath(new PartialPath("root.**.status"));
-    patternTree.appendPath(new PartialPath("root.**.s1"));
+    patternTree.appendPathPattern(new PartialPath("root.**.status"));
+    patternTree.appendPathPattern(new PartialPath("root.**.s1"));
     patternTree.constructTree();
 
     SchemaFetchScanOperator schemaFetchScanOperator =
diff --git 
a/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/metadata/read/SchemaFetchScanNodeTest.java
 
b/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/metadata/read/SchemaFetchScanNodeTest.java
index 0caefd0ad2..6f254b0275 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/metadata/read/SchemaFetchScanNodeTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/metadata/read/SchemaFetchScanNodeTest.java
@@ -35,11 +35,10 @@ public class SchemaFetchScanNodeTest {
 
   @Test
   public void testSerialization() throws IllegalPathException {
+    PathPatternTree patternTree = new PathPatternTree();
+    patternTree.appendPathPattern(new PartialPath("root.sg.**.*"));
     SchemaFetchScanNode schemaFetchScanNode =
-        new SchemaFetchScanNode(
-            new PlanNodeId("0"),
-            new PartialPath("root.sg"),
-            new PathPatternTree(new PartialPath("root.sg.**.*")));
+        new SchemaFetchScanNode(new PlanNodeId("0"), new 
PartialPath("root.sg"), patternTree);
     ByteBuffer byteBuffer = ByteBuffer.allocate(1024 * 1024);
     schemaFetchScanNode.serialize(byteBuffer);
     byteBuffer.flip();

Reply via email to