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

jiangtian 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 14ade2b8778 Avoid using tree model device cache to cache table names 
(#16413)
14ade2b8778 is described below

commit 14ade2b8778270255f4196d7912b2eff4d48527d
Author: Haonan <[email protected]>
AuthorDate: Tue Sep 16 09:31:58 2025 +0800

    Avoid using tree model device cache to cache table names (#16413)
    
    * Avoid using tree model device cache to cache table names
    
    * Fix UT
    
    * Fix IoTDBSubscriptionConsumerGroupIT
---
 .../it/session/IoTDBSessionRelationalIT.java       |  82 +++++++++++++++++
 .../agent/runtime/PipeDataNodeRuntimeAgent.java    |  23 ++++-
 .../iotdb/db/protocol/mqtt/MPPPublishHandler.java  |   8 +-
 .../v1/handler/StatementConstructionHandler.java   |   7 +-
 .../plan/parser/StatementGenerator.java            |   4 +-
 .../plan/planner/TableOperatorGenerator.java       | 100 ++++++++++-----------
 .../plan/statement/crud/InsertTabletStatement.java |   6 +-
 .../execute/utils/CompactionPathUtils.java         |   9 +-
 .../pipe/sink/PipeDataNodeThriftRequestTest.java   |  22 ++---
 9 files changed, 177 insertions(+), 84 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java
index 4e78947d77f..22e3e0ccd34 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java
@@ -26,6 +26,7 @@ import 
org.apache.iotdb.db.storageengine.dataregion.wal.io.WALReader;
 import org.apache.iotdb.isession.ISession;
 import org.apache.iotdb.isession.ITableSession;
 import org.apache.iotdb.isession.SessionDataSet;
+import org.apache.iotdb.isession.SessionDataSet.DataIterator;
 import org.apache.iotdb.it.env.EnvFactory;
 import org.apache.iotdb.it.env.cluster.env.SimpleEnv;
 import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper;
@@ -49,6 +50,7 @@ import org.apache.tsfile.write.v4.ITsFileWriter;
 import org.apache.tsfile.write.v4.TsFileWriterBuilder;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -1227,6 +1229,86 @@ public class IoTDBSessionRelationalIT {
     }
   }
 
+  @Test
+  public void autoCreateChineseCharacterTableTest()
+      throws IoTDBConnectionException, StatementExecutionException {
+    try (ITableSession session = 
EnvFactory.getEnv().getTableSessionConnection()) {
+      session.executeNonQueryStatement("USE \"db1\"");
+
+      List<IMeasurementSchema> schemaList = new ArrayList<>();
+      schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING));
+      schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING));
+      schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE));
+      final List<ColumnCategory> columnTypes =
+          Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, 
ColumnCategory.FIELD);
+
+      long timestamp = 0;
+      Tablet tablet =
+          new Tablet(
+              "\"表一表一\"",
+              IMeasurementSchema.getMeasurementNameList(schemaList),
+              IMeasurementSchema.getDataTypeList(schemaList),
+              columnTypes,
+              15);
+
+      for (long row = 0; row < 15; row++) {
+        int rowIndex = tablet.getRowSize();
+        tablet.addTimestamp(rowIndex, timestamp + row);
+        tablet.addValue("tag1", rowIndex, "tag:" + row);
+        tablet.addValue("attr1", rowIndex, "attr:" + row);
+        tablet.addValue("m1", rowIndex, row * 1.0);
+        if (tablet.getRowSize() == tablet.getMaxRowNumber()) {
+          session.insert(tablet);
+          tablet.reset();
+        }
+      }
+
+      SessionDataSet dataSet = session.executeQueryStatement("show tables from 
db1");
+      DataIterator iterator = dataSet.iterator();
+      while (iterator.next()) {
+        Assert.assertEquals("\"表一表一\"", iterator.getString(1));
+      }
+    }
+
+    try (ITableSession session = 
EnvFactory.getEnv().getTableSessionConnection()) {
+      session.executeNonQueryStatement("USE \"db2\"");
+
+      List<IMeasurementSchema> schemaList = new ArrayList<>();
+      schemaList.add(new MeasurementSchema("tag1", TSDataType.STRING));
+      schemaList.add(new MeasurementSchema("attr1", TSDataType.STRING));
+      schemaList.add(new MeasurementSchema("m1", TSDataType.DOUBLE));
+      final List<ColumnCategory> columnTypes =
+          Arrays.asList(ColumnCategory.TAG, ColumnCategory.ATTRIBUTE, 
ColumnCategory.FIELD);
+
+      long timestamp = 0;
+      Tablet tablet =
+          new Tablet(
+              "\"表一\"",
+              IMeasurementSchema.getMeasurementNameList(schemaList),
+              IMeasurementSchema.getDataTypeList(schemaList),
+              columnTypes,
+              15);
+
+      for (long row = 0; row < 15; row++) {
+        int rowIndex = tablet.getRowSize();
+        tablet.addTimestamp(rowIndex, timestamp + row);
+        tablet.addValue("tag1", rowIndex, "tag:" + row);
+        tablet.addValue("attr1", rowIndex, "attr:" + row);
+        tablet.addValue("m1", rowIndex, row * 1.0);
+        if (tablet.getRowSize() == tablet.getMaxRowNumber()) {
+          session.insert(tablet);
+          tablet.reset();
+        }
+      }
+
+      SessionDataSet dataSet = session.executeQueryStatement("show tables from 
db2");
+      DataIterator iterator = dataSet.iterator();
+      while (iterator.next()) {
+        Assert.assertEquals("\"表一\"", iterator.getString(1));
+      }
+    }
+  }
+
   @Test
   public void insertNonExistTableTest()
       throws IoTDBConnectionException, StatementExecutionException {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java
index 0b4a7e46932..5884ca94b23 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeDataNodeRuntimeAgent.java
@@ -22,9 +22,12 @@ package org.apache.iotdb.db.pipe.agent.runtime;
 import org.apache.iotdb.commons.consensus.SchemaRegionId;
 import org.apache.iotdb.commons.consensus.index.ProgressIndex;
 import org.apache.iotdb.commons.consensus.index.impl.RecoverProgressIndex;
+import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.exception.StartupException;
 import org.apache.iotdb.commons.exception.pipe.PipeRuntimeCriticalException;
 import org.apache.iotdb.commons.exception.pipe.PipeRuntimeException;
+import org.apache.iotdb.commons.path.MeasurementPath;
+import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.pipe.agent.runtime.PipePeriodicalJobExecutor;
 import 
org.apache.iotdb.commons.pipe.agent.runtime.PipePeriodicalPhantomReferenceCleaner;
 import org.apache.iotdb.commons.pipe.agent.task.meta.PipeTaskMeta;
@@ -40,11 +43,13 @@ import org.apache.iotdb.db.pipe.agent.PipeDataNodeAgent;
 import 
org.apache.iotdb.db.pipe.resource.PipeDataNodeHardlinkOrCopiedFileDirStartupCleaner;
 import org.apache.iotdb.db.pipe.resource.log.PipePeriodicalLogReducer;
 import org.apache.iotdb.db.pipe.source.schemaregion.SchemaRegionListeningQueue;
+import 
org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeDevicePathCache;
 import org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.InsertNode;
 import org.apache.iotdb.db.service.ResourcesInformationHolder;
-import 
org.apache.iotdb.db.storageengine.dataregion.compaction.execute.utils.CompactionPathUtils;
 import org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResource;
 
+import org.apache.tsfile.common.constant.TsFileConstant;
+import org.apache.tsfile.file.metadata.IDeviceID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -83,11 +88,23 @@ public class PipeDataNodeRuntimeAgent implements IService {
     PipeAgentLauncher.launchPipePluginAgent(resourcesInformationHolder);
     simpleProgressIndexAssigner.start();
 
-    IoTDBTreePattern.setDevicePathGetter(CompactionPathUtils::getPath);
-    IoTDBTreePattern.setMeasurementPathGetter(CompactionPathUtils::getPath);
+    IoTDBTreePattern.setDevicePathGetter(PipeDataNodeRuntimeAgent::getPath);
+    
IoTDBTreePattern.setMeasurementPathGetter(PipeDataNodeRuntimeAgent::getPath);
     PipeLogger.setLogger(PipePeriodicalLogReducer::log);
   }
 
+  private static MeasurementPath getPath(final IDeviceID device, final String 
measurement)
+      throws IllegalPathException {
+    return getPath(device).concatAsMeasurementPath(measurement);
+  }
+
+  private static PartialPath getPath(final IDeviceID device) throws 
IllegalPathException {
+    final String deviceId = device.toString();
+    return deviceId.contains(TsFileConstant.BACK_QUOTE_STRING)
+        ? DataNodeDevicePathCache.getInstance().getPartialPath(deviceId)
+        : new 
PartialPath(deviceId.split(TsFileConstant.PATH_SEPARATER_NO_REGEX));
+  }
+
   @Override
   public synchronized void start() throws StartupException {
     PipeConfig.getInstance().printAllConfigs();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
index 9f104007591..a6464a56c49 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/mqtt/MPPPublishHandler.java
@@ -20,7 +20,7 @@ package org.apache.iotdb.db.protocol.mqtt;
 
 import org.apache.iotdb.common.rpc.thrift.TSStatus;
 import org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion;
-import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
 import org.apache.iotdb.db.auth.AuthorityChecker;
 import org.apache.iotdb.db.conf.IoTDBConfig;
@@ -204,11 +204,9 @@ public class MPPPublishHandler extends 
AbstractInterceptHandler {
     }
   }
 
-  private InsertTabletStatement constructInsertTabletStatement(TableMessage 
message)
-      throws IllegalPathException {
+  private InsertTabletStatement constructInsertTabletStatement(TableMessage 
message) {
     InsertTabletStatement insertStatement = new InsertTabletStatement();
-    insertStatement.setDevicePath(
-        
DataNodeDevicePathCache.getInstance().getPartialPath(message.getTable()));
+    insertStatement.setDevicePath(new PartialPath(message.getTable(), false));
     List<String> measurements =
         Stream.of(message.getFields(), message.getTagKeys(), 
message.getAttributeKeys())
             .flatMap(List::stream)
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/table/v1/handler/StatementConstructionHandler.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/table/v1/handler/StatementConstructionHandler.java
index 70f3cfb826e..bda0627ce61 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/table/v1/handler/StatementConstructionHandler.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/rest/table/v1/handler/StatementConstructionHandler.java
@@ -18,10 +18,10 @@
 package org.apache.iotdb.db.protocol.rest.table.v1.handler;
 
 import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
 import org.apache.iotdb.db.exception.WriteProcessRejectException;
 import org.apache.iotdb.db.protocol.rest.table.v1.model.InsertTabletRequest;
-import 
org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeDevicePathCache;
 import 
org.apache.iotdb.db.queryengine.plan.statement.crud.InsertTabletStatement;
 import org.apache.iotdb.db.utils.TimestampPrecisionUtils;
 
@@ -36,16 +36,13 @@ import java.util.Locale;
 
 public class StatementConstructionHandler {
 
-  private static final DataNodeDevicePathCache DEVICE_PATH_CACHE =
-      DataNodeDevicePathCache.getInstance();
-
   private StatementConstructionHandler() {}
 
   public static InsertTabletStatement constructInsertTabletStatement(
       InsertTabletRequest insertTabletReq)
       throws IllegalPathException, WriteProcessRejectException {
     InsertTabletStatement insertStatement = new InsertTabletStatement();
-    
insertStatement.setDevicePath(DEVICE_PATH_CACHE.getPartialPath(insertTabletReq.getTable()));
+    insertStatement.setDevicePath(new PartialPath(insertTabletReq.getTable(), 
false));
     
insertStatement.setMeasurements(insertTabletReq.getColumnNames().toArray(new 
String[0]));
     long[] timestamps =
         
insertTabletReq.getTimestamps().stream().mapToLong(Long::longValue).toArray();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
index 8d5fe8d48f0..5ff879cf141 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGenerator.java
@@ -333,7 +333,9 @@ public class StatementGenerator {
     // construct insert statement
     InsertTabletStatement insertStatement = new InsertTabletStatement();
     insertStatement.setDevicePath(
-        DEVICE_PATH_CACHE.getPartialPath(insertTabletReq.getPrefixPath()));
+        insertTabletReq.isWriteToTable()
+            ? new PartialPath(insertTabletReq.getPrefixPath(), false)
+            : 
DEVICE_PATH_CACHE.getPartialPath(insertTabletReq.getPrefixPath()));
     
insertStatement.setMeasurements(insertTabletReq.getMeasurements().toArray(new 
String[0]));
     TSDataType[] dataTypes = new TSDataType[insertTabletReq.types.size()];
     for (int i = 0; i < insertTabletReq.types.size(); i++) {
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 d6c2e53c24b..88c4cc4b982 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
@@ -3695,63 +3695,59 @@ public class TableOperatorGenerator extends 
PlanVisitor<Operator, LocalExecution
                 node.getPlanNodeId(),
                 TableIntoOperator.class.getSimpleName());
 
-    try {
-      PartialPath targetTable = 
DEVICE_PATH_CACHE.getPartialPath(node.getTable());
-
-      Map<String, TSDataType> tsDataTypeMap = new LinkedHashMap<>();
-      Map<String, InputLocation> inputLocationMap = new LinkedHashMap<>();
-      List<TSDataType> inputColumnTypes = new ArrayList<>();
-      List<TsTableColumnCategory> inputColumnCategories = new ArrayList<>();
-
-      List<ColumnSchema> originColumns = node.getColumns();
-      List<Symbol> originInputColumnNames = node.getNeededInputColumnNames();
-      int size = originColumns.size();
-      List<ColumnSchema> inputColumns = new ArrayList<>(size);
-
-      List<Symbol> childOutputName = node.getChild().getOutputSymbols();
-      Map<Symbol, Integer> map = new HashMap<>(childOutputName.size());
-      for (int i = 0; i < size; i++) {
-        map.put(childOutputName.get(i), i);
-        inputColumns.add(null);
-      }
-      for (int i = 0; i < size; i++) {
-        int index = map.get(originInputColumnNames.get(i));
-        inputColumns.set(index, originColumns.get(i));
-      }
-
-      for (int i = 0; i < inputColumns.size(); i++) {
-        String columnName = inputColumns.get(i).getName();
-        inputLocationMap.put(columnName, new InputLocation(0, i));
+    PartialPath targetTable = new PartialPath(node.getTable(), false);
+
+    Map<String, TSDataType> tsDataTypeMap = new LinkedHashMap<>();
+    Map<String, InputLocation> inputLocationMap = new LinkedHashMap<>();
+    List<TSDataType> inputColumnTypes = new ArrayList<>();
+    List<TsTableColumnCategory> inputColumnCategories = new ArrayList<>();
+
+    List<ColumnSchema> originColumns = node.getColumns();
+    List<Symbol> originInputColumnNames = node.getNeededInputColumnNames();
+    int size = originColumns.size();
+    List<ColumnSchema> inputColumns = new ArrayList<>(size);
+
+    List<Symbol> childOutputName = node.getChild().getOutputSymbols();
+    Map<Symbol, Integer> map = new HashMap<>(childOutputName.size());
+    for (int i = 0; i < size; i++) {
+      map.put(childOutputName.get(i), i);
+      inputColumns.add(null);
+    }
+    for (int i = 0; i < size; i++) {
+      int index = map.get(originInputColumnNames.get(i));
+      inputColumns.set(index, originColumns.get(i));
+    }
 
-        TsTableColumnCategory columnCategory = 
inputColumns.get(i).getColumnCategory();
-        if (columnCategory == TIME) {
-          continue;
-        }
+    for (int i = 0; i < inputColumns.size(); i++) {
+      String columnName = inputColumns.get(i).getName();
+      inputLocationMap.put(columnName, new InputLocation(0, i));
 
-        TSDataType columnType = 
InternalTypeManager.getTSDataType(inputColumns.get(i).getType());
-        tsDataTypeMap.put(columnName, columnType);
-        inputColumnTypes.add(columnType);
-        inputColumnCategories.add(columnCategory);
+      TsTableColumnCategory columnCategory = 
inputColumns.get(i).getColumnCategory();
+      if (columnCategory == TIME) {
+        continue;
       }
 
-      long statementSizePerLine =
-          
OperatorGeneratorUtil.calculateStatementSizePerLine(inputColumnTypes);
-
-      return new TableIntoOperator(
-          operatorContext,
-          child,
-          node.getDatabase(),
-          targetTable,
-          inputColumnTypes,
-          inputColumnCategories,
-          inputLocationMap,
-          tsDataTypeMap,
-          true,
-          FragmentInstanceManager.getInstance().getIntoOperationExecutor(),
-          statementSizePerLine);
-    } catch (IllegalPathException e) {
-      throw new IllegalArgumentException(e);
+      TSDataType columnType = 
InternalTypeManager.getTSDataType(inputColumns.get(i).getType());
+      tsDataTypeMap.put(columnName, columnType);
+      inputColumnTypes.add(columnType);
+      inputColumnCategories.add(columnCategory);
     }
+
+    long statementSizePerLine =
+        OperatorGeneratorUtil.calculateStatementSizePerLine(inputColumnTypes);
+
+    return new TableIntoOperator(
+        operatorContext,
+        child,
+        node.getDatabase(),
+        targetTable,
+        inputColumnTypes,
+        inputColumnCategories,
+        inputLocationMap,
+        tsDataTypeMap,
+        true,
+        FragmentInstanceManager.getInstance().getIntoOperationExecutor(),
+        statementSizePerLine);
   }
 
   private boolean[] checkStatisticAndScanOrder(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java
index 4c255e0882f..4680c313ba5 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java
@@ -106,7 +106,11 @@ public class InsertTabletStatement extends 
InsertBaseStatement implements ISchem
             .toArray(String[]::new));
     setDataTypes(
         
tablet.getSchemas().stream().map(IMeasurementSchema::getType).toArray(TSDataType[]::new));
-    
setDevicePath(DataNodeDevicePathCache.getInstance().getPartialPath(tablet.getDeviceId()));
+    if (Objects.nonNull(databaseName)) {
+      setDevicePath(new PartialPath(tablet.getTableName(), false));
+    } else {
+      
setDevicePath(DataNodeDevicePathCache.getInstance().getPartialPath(tablet.getDeviceId()));
+    }
     setAligned(isAligned);
     setTimes(tablet.getTimestamps());
     
setColumns(Arrays.stream(tablet.getValues()).map(this::convertTableColumn).toArray());
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionPathUtils.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionPathUtils.java
index 5e452708bca..0b26202a0ac 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionPathUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionPathUtils.java
@@ -38,13 +38,10 @@ public class CompactionPathUtils {
 
   public static PartialPath getPath(final IDeviceID device) throws 
IllegalPathException {
     if (device.isTableModel()) {
-      final String[] tableNameSegments =
-          
DataNodeDevicePathCache.getInstance().getPartialPath(device.getTableName()).getNodes();
-      final String[] nodes = new String[device.segmentNum() + 
tableNameSegments.length - 1];
-      System.arraycopy(tableNameSegments, 0, nodes, 0, 
tableNameSegments.length);
+      final String[] nodes = new String[device.segmentNum() + 1];
+      nodes[0] = device.getTableName();
       for (int i = 0; i < device.segmentNum() - 1; i++) {
-        nodes[i + tableNameSegments.length] =
-            device.segment(i + 1) == null ? null : device.segment(i + 
1).toString();
+        nodes[i + 1] = device.segment(i + 1) == null ? null : device.segment(i 
+ 1).toString();
       }
       return new PartialPath(nodes);
     } else {
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeDataNodeThriftRequestTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeDataNodeThriftRequestTest.java
index 19567e5d935..1a122c63d4f 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeDataNodeThriftRequestTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/sink/PipeDataNodeThriftRequestTest.java
@@ -261,7 +261,7 @@ public class PipeDataNodeThriftRequestTest {
       schemaList.add(new MeasurementSchema("s8", TSDataType.DATE));
       schemaList.add(new MeasurementSchema("s9", TSDataType.BLOB));
       schemaList.add(new MeasurementSchema("s10", TSDataType.STRING));
-      final Tablet t = new Tablet("root.sg.d", schemaList, 1024);
+      final Tablet t = new Tablet("t", schemaList, 1024);
       t.addTimestamp(0, 2000);
       t.addTimestamp(1, 1000);
       t.addValue("s1", 0, 2);
@@ -286,16 +286,16 @@ public class PipeDataNodeThriftRequestTest {
       final InsertBaseStatement statement =
           req.constructStatement(); // will call 
PipeTransferTabletRawReq.sortTablet() here
       List<PartialPath> paths = new ArrayList<>();
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s1"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s2"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s3"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s4"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s5"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s6"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s7"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s8"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s9"}));
-      paths.add(new PartialPath(new String[] {"root", "sg", "d", "s10"}));
+      paths.add(new PartialPath(new String[] {"t", "s1"}));
+      paths.add(new PartialPath(new String[] {"t", "s2"}));
+      paths.add(new PartialPath(new String[] {"t", "s3"}));
+      paths.add(new PartialPath(new String[] {"t", "s4"}));
+      paths.add(new PartialPath(new String[] {"t", "s5"}));
+      paths.add(new PartialPath(new String[] {"t", "s6"}));
+      paths.add(new PartialPath(new String[] {"t", "s7"}));
+      paths.add(new PartialPath(new String[] {"t", "s8"}));
+      paths.add(new PartialPath(new String[] {"t", "s9"}));
+      paths.add(new PartialPath(new String[] {"t", "s10"}));
       Assert.assertEquals(statement.getPaths(), paths);
 
       Assert.assertTrue(statement.isWriteToTable());

Reply via email to