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

jackietien pushed a commit to branch ty/TableModelGrammar
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/ty/TableModelGrammar by this 
push:
     new 226a8c3b95c fix compile error
     new 2cfa04d38c7 Merge branch 'ty/TableModelGrammar' of 
https://github.com/apache/iotdb into ty/TableModelGrammar
226a8c3b95c is described below

commit 226a8c3b95c44844d4be375b40e4535b605b8c89
Author: JackieTien97 <[email protected]>
AuthorDate: Thu May 30 19:39:02 2024 +0800

    fix compile error
---
 .../operator/schema/source/DeviceSchemaSource.java |  2 +-
 .../execution/operator/source/SeriesScanUtil.java  |  2 +-
 .../analyze/cache/schema/DataNodeTTLCache.java     | 16 +++++-
 .../plan/planner/OperatorTreeGenerator.java        |  4 +-
 .../db/storageengine/dataregion/DataRegion.java    |  8 +--
 .../performer/impl/FastCompactionPerformer.java    |  3 +-
 .../execute/utils/MultiTsFileDeviceIterator.java   |  7 +--
 .../selector/impl/SettleSelectorImpl.java          |  9 ++-
 .../dataregion/memtable/TsFileProcessor.java       | 16 +++---
 .../db/storageengine/dataregion/TTLQueryTest.java  | 67 +++++++++++++++++-----
 .../settle/SettleCompactionTaskTest.java           | 35 +++++------
 11 files changed, 110 insertions(+), 59 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java
index 03c53d5a791..37a9d63865c 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/DeviceSchemaSource.java
@@ -101,7 +101,7 @@ public class DeviceSchemaSource implements 
ISchemaSource<IDeviceSchemaInfo> {
         .getColumnBuilder(0)
         .writeBinary(new Binary(device.getFullPath(), 
TSFileConfig.STRING_CHARSET));
     int templateId = device.getTemplateId();
-    long ttl = DataNodeTTLCache.getInstance().getTTL(device.getFullPath());
+    long ttl = 
DataNodeTTLCache.getInstance().getTTL(device.getPartialPath().getNodes());
     // TODO: make it more readable, like "30 days" or "10 hours"
     String ttlStr = ttl == Long.MAX_VALUE ? IoTDBConstant.TTL_INFINITE : 
String.valueOf(ttl);
     if (hasSgCol) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
index 8520edd43c1..5ae6d828cb4 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/SeriesScanUtil.java
@@ -175,7 +175,7 @@ public class SeriesScanUtil implements Accountable {
     this.dataSource = dataSource;
 
     // updated filter concerning TTL
-    
scanOptions.setTTL(DataNodeTTLCache.getInstance().getTTL(seriesPath.getDevice()));
+    
scanOptions.setTTL(DataNodeTTLCache.getInstance().getTTL(seriesPath.getDeviceId()));
 
     // init file index
     orderUtils.setCurSeqFileIndex(dataSource);
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/schema/DataNodeTTLCache.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/schema/DataNodeTTLCache.java
index 3b951c23a5a..5305a4f27a1 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/schema/DataNodeTTLCache.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/schema/DataNodeTTLCache.java
@@ -21,6 +21,8 @@ package 
org.apache.iotdb.db.queryengine.plan.analyze.cache.schema;
 import org.apache.iotdb.commons.schema.ttl.TTLCache;
 import org.apache.iotdb.commons.utils.TestOnly;
 
+import org.apache.tsfile.file.metadata.IDeviceID;
+
 import java.util.Map;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
@@ -70,10 +72,20 @@ public class DataNodeTTLCache {
     }
   }
 
-  public long getTTL(String path) {
+  public long getTTL(String[] path) {
+    lock.readLock().lock();
+    try {
+      return ttlCache.getClosestTTL(path);
+    } finally {
+      lock.readLock().unlock();
+    }
+  }
+
+  public long getTTL(IDeviceID deviceID) {
     lock.readLock().lock();
     try {
-      return ttlCache.getClosestTTL(path.split(PATH_SEPARATER_NO_REGEX));
+      // TODO Tien change this way
+      return 
ttlCache.getClosestTTL(deviceID.toString().split(PATH_SEPARATER_NO_REGEX));
     } finally {
       lock.readLock().unlock();
     }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
index bde6949ec2f..d8c572ce000 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
@@ -2636,7 +2636,7 @@ public class OperatorTreeGenerator extends 
PlanVisitor<Operator, LocalExecutionP
     } else if (!LastQueryUtil.satisfyFilter(
         updateFilterUsingTTL(
             context.getGlobalTimeFilter(),
-            DataNodeTTLCache.getInstance().getTTL(seriesPath.getDevice())),
+            DataNodeTTLCache.getInstance().getTTL(seriesPath.getIDeviceID())),
         timeValuePair)) { // cached last value is not satisfied
 
       if (!isFilterGtOrGe(context.getGlobalTimeFilter())) {
@@ -2851,7 +2851,7 @@ public class OperatorTreeGenerator extends 
PlanVisitor<Operator, LocalExecutionP
       } else if (!LastQueryUtil.satisfyFilter(
           updateFilterUsingTTL(
               context.getGlobalTimeFilter(),
-              DataNodeTTLCache.getInstance().getTTL(devicePath.getFullPath())),
+              
DataNodeTTLCache.getInstance().getTTL(alignedPath.getIDeviceID())),
           timeValuePair)) { // cached last value is not satisfied
 
         if (!isFilterGtOrGe(context.getGlobalTimeFilter())) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index 24d60d3736e..2d9a7bed20c 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -873,7 +873,7 @@ public class DataRegion implements IDataRegionForQuery {
   public void insert(InsertRowNode insertRowNode) throws WriteProcessException 
{
     // reject insertions that are out of ttl
     long deviceTTL =
-        
DataNodeTTLCache.getInstance().getTTL(insertRowNode.getDevicePath().getFullPath());
+        
DataNodeTTLCache.getInstance().getTTL(insertRowNode.getDevicePath().getNodes());
     if (!isAlive(insertRowNode.getTime(), deviceTTL)) {
       throw new OutOfTTLException(
           insertRowNode.getTime(), (CommonDateTimeUtils.currentTime() - 
deviceTTL));
@@ -939,7 +939,7 @@ public class DataRegion implements IDataRegionForQuery {
       Arrays.fill(results, RpcUtils.SUCCESS_STATUS);
       boolean noFailure = true;
       long deviceTTL =
-          
DataNodeTTLCache.getInstance().getTTL(insertTabletNode.getDevicePath().getFullPath());
+          
DataNodeTTLCache.getInstance().getTTL(insertTabletNode.getDevicePath().getNodes());
 
       /*
        * assume that batch has been sorted by client
@@ -3225,7 +3225,7 @@ public class DataRegion implements IDataRegionForQuery {
       }
       long deviceTTL =
           DataNodeTTLCache.getInstance()
-              .getTTL(insertRowsOfOneDeviceNode.getDevicePath().getFullPath());
+              .getTTL(insertRowsOfOneDeviceNode.getDevicePath().getNodes());
       long[] costsForMetrics = new long[4];
       Map<TsFileProcessor, InsertRowsNode> tsFileProcessorMap = new 
HashMap<>();
       for (int i = 0; i < 
insertRowsOfOneDeviceNode.getInsertRowNodeList().size(); i++) {
@@ -3341,7 +3341,7 @@ public class DataRegion implements IDataRegionForQuery {
       for (int i = 0; i < insertRowsNode.getInsertRowNodeList().size(); i++) {
         InsertRowNode insertRowNode = 
insertRowsNode.getInsertRowNodeList().get(i);
         long deviceTTL =
-            
DataNodeTTLCache.getInstance().getTTL(insertRowNode.getDevicePath().getFullPath());
+            
DataNodeTTLCache.getInstance().getTTL(insertRowNode.getDevicePath().getNodes());
         if (!isAlive(insertRowNode.getTime(), deviceTTL)) {
           insertRowsNode
               .getResults()
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/performer/impl/FastCompactionPerformer.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/performer/impl/FastCompactionPerformer.java
index d4f0bdad39b..cb13afa3fc2 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/performer/impl/FastCompactionPerformer.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/performer/impl/FastCompactionPerformer.java
@@ -46,7 +46,6 @@ import 
org.apache.iotdb.db.utils.datastructure.PatternTreeMapFactory;
 
 import org.apache.tsfile.exception.write.PageException;
 import org.apache.tsfile.file.metadata.IDeviceID;
-import org.apache.tsfile.file.metadata.PlainDeviceID;
 import org.apache.tsfile.read.TsFileSequenceReader;
 import org.apache.tsfile.utils.Pair;
 import org.apache.tsfile.write.schema.IMeasurementSchema;
@@ -142,7 +141,7 @@ public class FastCompactionPerformer
                         device,
                         DataNodeTTLCache.getInstance()
                             // TODO: remove deviceId conversion
-                            .getTTL(((PlainDeviceID) device).toStringID())));
+                            .getTTL(device)));
         sortedSourceFiles.sort(Comparator.comparingLong(x -> 
x.getStartTime(device)));
 
         if (sortedSourceFiles.isEmpty()) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java
index 1e32f1e3240..0e99607701e 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java
@@ -38,7 +38,6 @@ import org.apache.tsfile.file.metadata.AlignedChunkMetadata;
 import org.apache.tsfile.file.metadata.ChunkMetadata;
 import org.apache.tsfile.file.metadata.IChunkMetadata;
 import org.apache.tsfile.file.metadata.IDeviceID;
-import org.apache.tsfile.file.metadata.PlainDeviceID;
 import org.apache.tsfile.file.metadata.TimeseriesMetadata;
 import org.apache.tsfile.read.TsFileDeviceIterator;
 import org.apache.tsfile.read.TsFileSequenceReader;
@@ -407,8 +406,7 @@ public class MultiTsFileDeviceIterator implements 
AutoCloseable {
                 // TODO: remove deviceId conversion
                 long timeLowerBound =
                     CommonDateTimeUtils.currentTime()
-                        - DataNodeTTLCache.getInstance()
-                            .getTTL(((PlainDeviceID) device).toStringID());
+                        - DataNodeTTLCache.getInstance().getTTL(device);
                 if (r.getStartTime(device) < timeLowerBound) {
                   try {
                     list.add(
@@ -637,8 +635,7 @@ public class MultiTsFileDeviceIterator implements 
AutoCloseable {
                       // TODO: remove deviceId conversion
                       long timeLowerBound =
                           CommonDateTimeUtils.currentTime()
-                              - DataNodeTTLCache.getInstance()
-                                  .getTTL(((PlainDeviceID) 
device).toStringID());
+                              - DataNodeTTLCache.getInstance().getTTL(device);
                       if (r.getStartTime(device) < timeLowerBound) {
                         try {
                           list.add(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
index 343a1fb593d..6261a2e7ac6 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
@@ -35,12 +35,11 @@ import 
org.apache.iotdb.db.storageengine.dataregion.modification.ModificationFil
 import org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileManager;
 import org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResource;
 import 
org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResourceStatus;
-import 
org.apache.iotdb.db.storageengine.dataregion.tsfile.timeindex.DeviceTimeIndex;
+import 
org.apache.iotdb.db.storageengine.dataregion.tsfile.timeindex.ArrayDeviceTimeIndex;
 import 
org.apache.iotdb.db.storageengine.dataregion.tsfile.timeindex.FileTimeIndex;
 import 
org.apache.iotdb.db.storageengine.dataregion.tsfile.timeindex.ITimeIndex;
 
 import org.apache.tsfile.file.metadata.IDeviceID;
-import org.apache.tsfile.file.metadata.PlainDeviceID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -210,10 +209,10 @@ public class SettleSelectorImpl implements 
ISettleSelector {
     long currentTime = CommonDateTimeUtils.currentTime();
 
     Collection<Modification> modifications = modFile.getModifications();
-    for (IDeviceID device : ((DeviceTimeIndex) timeIndex).getDevices()) {
+    for (IDeviceID device : ((ArrayDeviceTimeIndex) timeIndex).getDevices()) {
       // check expired device by ttl
       // TODO: remove deviceId conversion
-      long deviceTTL = DataNodeTTLCache.getInstance().getTTL(((PlainDeviceID) 
device).toStringID());
+      long deviceTTL = DataNodeTTLCache.getInstance().getTTL(device);
       boolean hasSetTTL = deviceTTL != Long.MAX_VALUE;
       boolean isDeleted =
           !timeIndex.isDeviceAlive(device, deviceTTL)
@@ -241,7 +240,7 @@ public class SettleSelectorImpl implements ISettleSelector {
     }
 
     double deletedDeviceRatio =
-        ((double) deletedDevices.size()) / ((DeviceTimeIndex) 
timeIndex).getDevices().size();
+        ((double) deletedDevices.size()) / ((ArrayDeviceTimeIndex) 
timeIndex).getDevices().size();
     if (deletedDeviceRatio == 1d) {
       // the whole file is completely dirty
       return new FileDirtyInfo(DirtyStatus.FULLY_DIRTY);
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
index 1e7d3c58002..02898d98519 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
@@ -84,7 +84,6 @@ import org.apache.tsfile.file.metadata.AlignedChunkMetadata;
 import org.apache.tsfile.file.metadata.ChunkMetadata;
 import org.apache.tsfile.file.metadata.IChunkMetadata;
 import org.apache.tsfile.file.metadata.IDeviceID;
-import org.apache.tsfile.file.metadata.PlainDeviceID;
 import org.apache.tsfile.utils.Binary;
 import org.apache.tsfile.utils.Pair;
 import org.apache.tsfile.write.writer.RestorableTsFileIOWriter;
@@ -1709,7 +1708,7 @@ public class TsFileProcessor {
 
   private List<IChunkMetadata> getVisibleMetadataListFromWriterByDeviceID(
       QueryContext queryContext, IDeviceID deviceID) throws 
IllegalPathException {
-    long timeLowerBound = getQueryTimeLowerBound(((PlainDeviceID) 
deviceID).toStringID());
+    long timeLowerBound = getQueryTimeLowerBound(deviceID);
     List<List<ChunkMetadata>> chunkMetaDataListForDevice =
         writer.getVisibleMetadataList(deviceID, null);
     List<ChunkMetadata> processedChunkMetadataForOneDevice = new ArrayList<>();
@@ -1762,7 +1761,7 @@ public class TsFileProcessor {
       }
     }
 
-    long timeLowerBound = getQueryTimeLowerBound(((PlainDeviceID) 
deviceID).toStringID());
+    long timeLowerBound = getQueryTimeLowerBound(deviceID);
     
ModificationUtils.modifyAlignedChunkMetaData(alignedChunkMetadataForOneDevice, 
modifications);
     alignedChunkMetadataForOneDevice.removeIf(x -> x.getEndTime() < 
timeLowerBound);
     return new ArrayList<>(alignedChunkMetadataForOneDevice);
@@ -1782,7 +1781,8 @@ public class TsFileProcessor {
         for (IFullPath seriesPath : pathList) {
           Map<String, List<IChunkMetadata>> measurementToChunkMetaList = new 
HashMap<>();
           Map<String, List<IChunkHandle>> measurementToChunkHandleList = new 
HashMap<>();
-          long timeLowerBound = getQueryTimeLowerBound(seriesPath.getDevice());
+          // TODO Tien change the way
+          long timeLowerBound = 
getQueryTimeLowerBound(seriesPath.getDeviceId());
           for (IMemTable flushingMemTable : flushingMemTables) {
             if (flushingMemTable.isSignalMemTable()) {
               continue;
@@ -1866,7 +1866,7 @@ public class TsFileProcessor {
         for (Map.Entry<IDeviceID, Boolean> entry : 
devicePathToAligned.entrySet()) {
           IDeviceID devicePath = entry.getKey();
           boolean isAligned = entry.getValue();
-          long timeLowerBound = getQueryTimeLowerBound(((PlainDeviceID) 
devicePath).toStringID());
+          long timeLowerBound = getQueryTimeLowerBound(devicePath);
           Map<String, List<IChunkMetadata>> measurementToChunkMetadataList = 
new HashMap<>();
           Map<String, List<IChunkHandle>> measurementToMemChunkHandleList = 
new HashMap<>();
           for (IMemTable flushingMemTable : flushingMemTables) {
@@ -1956,7 +1956,7 @@ public class TsFileProcessor {
       try {
         for (IFullPath seriesPath : seriesPaths) {
           List<ReadOnlyMemChunk> readOnlyMemChunks = new ArrayList<>();
-          long timeLowerBound = getQueryTimeLowerBound(seriesPath.getDevice());
+          long timeLowerBound = 
getQueryTimeLowerBound(seriesPath.getDeviceId());
           for (IMemTable flushingMemTable : flushingMemTables) {
             if (flushingMemTable.isSignalMemTable()) {
               continue;
@@ -2017,8 +2017,8 @@ public class TsFileProcessor {
     }
   }
 
-  private long getQueryTimeLowerBound(String device) {
-    long deviceTTL = DataNodeTTLCache.getInstance().getTTL(device);
+  private long getQueryTimeLowerBound(IDeviceID deviceID) {
+    long deviceTTL = DataNodeTTLCache.getInstance().getTTL(deviceID);
     return deviceTTL != Long.MAX_VALUE
         ? CommonDateTimeUtils.currentTime() - deviceTTL
         : Long.MIN_VALUE;
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/TTLQueryTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/TTLQueryTest.java
index 5596299db80..d2cea9fd1ca 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/TTLQueryTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/TTLQueryTest.java
@@ -21,7 +21,8 @@ package org.apache.iotdb.db.storageengine.dataregion;
 
 import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.path.IFullPath;
+import org.apache.iotdb.commons.path.NonAlignedFullPath;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.exception.query.QueryProcessException;
 import 
org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeTTLCache;
@@ -30,7 +31,9 @@ import 
org.apache.iotdb.db.storageengine.dataregion.read.QueryDataSource;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 
 import org.apache.tsfile.exception.write.WriteProcessException;
+import org.apache.tsfile.file.metadata.IDeviceID;
 import org.apache.tsfile.read.TimeValuePair;
+import org.apache.tsfile.write.schema.MeasurementSchema;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -43,6 +46,7 @@ import java.util.List;
 import java.util.Map;
 
 import static 
org.apache.iotdb.db.storageengine.dataregion.compaction.utils.TsFileGeneratorUtils.createTimeseries;
+import static org.apache.tsfile.utils.TsFileGeneratorUtils.getDataType;
 
 public class TTLQueryTest extends AbstractCompactionTest {
 
@@ -72,16 +76,28 @@ public class TTLQueryTest extends AbstractCompactionTest {
     dataRegion.getTsFileManager().addAll(unseqResources, false);
     tsFileManager = dataRegion.getTsFileManager();
 
-    List<PartialPath> pathList = new ArrayList<>();
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d1", "s0"));
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d3", "s1"));
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d5", "s2"));
+    List<IFullPath> pathList = new ArrayList<>();
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d1"),
+            new MeasurementSchema("s0", getDataType(0))));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d3"),
+            new MeasurementSchema("s1", getDataType(1))));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d5"),
+            new MeasurementSchema("s2", getDataType(2))));
 
     QueryDataSource queryDataSource =
         dataRegion.query(pathList, null, EnvironmentUtils.TEST_QUERY_CONTEXT, 
null, null);
     Assert.assertEquals(10, queryDataSource.getSeqResources().size());
     Assert.assertEquals(10, queryDataSource.getUnseqResources().size());
-    Map<PartialPath, List<TimeValuePair>> sourceDatas =
+    Map<IFullPath, List<TimeValuePair>> sourceDatas =
         readSourceFiles(createTimeseries(6, 10, false), 
Collections.emptyList());
     Assert.assertEquals(1000, sourceDatas.get(pathList.get(0)).size());
     Assert.assertEquals(1000, sourceDatas.get(pathList.get(1)).size());
@@ -111,12 +127,21 @@ public class TTLQueryTest extends AbstractCompactionTest {
     Assert.assertTrue(sourceDatas.get(pathList.get(2)).get(0).getTimestamp() 
>= 1707137815000L);
 
     pathList.clear();
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d5", "s1"));
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d5", "s2"));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d5"),
+            new MeasurementSchema("s1", getDataType(1))));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d5"),
+            new MeasurementSchema("s2", getDataType(2))));
     queryDataSource =
         dataRegion.query(
             pathList,
-            COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d5",
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d5"),
             EnvironmentUtils.TEST_QUERY_CONTEXT,
             null,
             null);
@@ -125,10 +150,26 @@ public class TTLQueryTest extends AbstractCompactionTest {
 
     // reset ttl to 1
     pathList.clear();
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d1", "s0"));
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d3", "s1"));
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d5", "s2"));
-    pathList.add(new PartialPath(COMPACTION_TEST_SG + 
IoTDBConstant.PATH_SEPARATOR + "d0", "s2"));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d1"),
+            new MeasurementSchema("s0", getDataType(0))));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d3"),
+            new MeasurementSchema("s1", getDataType(1))));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d5"),
+            new MeasurementSchema("s2", getDataType(2))));
+    pathList.add(
+        new NonAlignedFullPath(
+            IDeviceID.Factory.DEFAULT_FACTORY.create(
+                COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d0"),
+            new MeasurementSchema("s2", getDataType(2))));
 
     DataNodeTTLCache.getInstance()
         .setTTL(COMPACTION_TEST_SG + IoTDBConstant.PATH_SEPARATOR + "d1", 1L);
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java
index f5bc90740f1..e8292b6c5d4 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java
@@ -22,9 +22,9 @@ package 
org.apache.iotdb.db.storageengine.dataregion.compaction.settle;
 import org.apache.iotdb.commons.conf.IoTDBConstant;
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.exception.MetadataException;
-import org.apache.iotdb.commons.path.AlignedPath;
-import org.apache.iotdb.commons.path.MeasurementPath;
-import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.commons.path.AlignedFullPath;
+import org.apache.iotdb.commons.path.IFullPath;
+import org.apache.iotdb.commons.path.NonAlignedFullPath;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import 
org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeTTLCache;
@@ -45,6 +45,7 @@ import 
org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResourceStatus;
 import org.apache.tsfile.common.conf.TSFileDescriptor;
 import org.apache.tsfile.enums.TSDataType;
 import org.apache.tsfile.exception.write.WriteProcessException;
+import org.apache.tsfile.file.metadata.IDeviceID;
 import org.apache.tsfile.read.TimeValuePair;
 import org.apache.tsfile.utils.TsFileGeneratorUtils;
 import org.apache.tsfile.write.schema.MeasurementSchema;
@@ -167,7 +168,7 @@ public class SettleCompactionTaskTest extends 
AbstractCompactionTest {
     Assert.assertEquals(5, unseqTasks.get(0).getFullyDirtyFiles().size());
     Assert.assertEquals(0, unseqTasks.get(0).getPartiallyDirtyFiles().size());
 
-    Map<PartialPath, List<TimeValuePair>> sourceDatas =
+    Map<IFullPath, List<TimeValuePair>> sourceDatas =
         readSourceFiles(createTimeseries(6, 6, isAligned), 
Collections.emptyList());
 
     List<TsFileResource> allDeletedFiles = new ArrayList<>(seqResources);
@@ -202,7 +203,7 @@ public class SettleCompactionTaskTest extends 
AbstractCompactionTest {
     tsFileManager.addAll(seqResources, true);
     tsFileManager.addAll(unseqResources, false);
 
-    Map<PartialPath, List<TimeValuePair>> sourceDatas =
+    Map<IFullPath, List<TimeValuePair>> sourceDatas =
         readSourceFiles(createTimeseries(6, 6, isAligned), 
Collections.emptyList());
 
     SettleCompactionTask task =
@@ -241,7 +242,7 @@ public class SettleCompactionTaskTest extends 
AbstractCompactionTest {
     tsFileManager.addAll(seqResources, true);
     tsFileManager.addAll(unseqResources, false);
 
-    Map<PartialPath, List<TimeValuePair>> sourceDatas =
+    Map<IFullPath, List<TimeValuePair>> sourceDatas =
         readSourceFiles(createTimeseries(6, 6, isAligned), 
Collections.emptyList());
 
     List<TsFileResource> partialDeletedFiles = new ArrayList<>();
@@ -290,7 +291,7 @@ public class SettleCompactionTaskTest extends 
AbstractCompactionTest {
     tsFileManager.addAll(seqResources, true);
     tsFileManager.addAll(unseqResources, false);
 
-    Map<PartialPath, List<TimeValuePair>> sourceDatas =
+    Map<IFullPath, List<TimeValuePair>> sourceDatas =
         readSourceFiles(createTimeseries(6, 6, isAligned), 
Collections.emptyList());
 
     List<TsFileResource> allDeletedFiles = new ArrayList<>(seqResources);
@@ -326,7 +327,7 @@ public class SettleCompactionTaskTest extends 
AbstractCompactionTest {
     tsFileManager.addAll(seqResources, true);
     tsFileManager.addAll(unseqResources, false);
 
-    Map<PartialPath, List<TimeValuePair>> sourceDatas =
+    Map<IFullPath, List<TimeValuePair>> sourceDatas =
         readSourceFiles(createTimeseries(6, 6, isAligned), 
Collections.emptyList());
 
     List<TsFileResource> partialDeletedFiles = new ArrayList<>();
@@ -374,7 +375,7 @@ public class SettleCompactionTaskTest extends 
AbstractCompactionTest {
     tsFileManager.addAll(seqResources, true);
     tsFileManager.addAll(unseqResources, false);
 
-    Map<PartialPath, List<TimeValuePair>> sourceDatas =
+    Map<IFullPath, List<TimeValuePair>> sourceDatas =
         readSourceFiles(createTimeseries(6, 6, isAligned), 
Collections.emptyList());
 
     List<TsFileResource> partialDeletedFiles = new ArrayList<>();
@@ -406,21 +407,23 @@ public class SettleCompactionTaskTest extends 
AbstractCompactionTest {
     validateTargetDatas(sourceDatas, Collections.emptyList());
   }
 
-  public static List<PartialPath> createTimeseries(
+  public static List<IFullPath> createTimeseries(
       int deviceNum, int measurementNum, boolean isAligned) throws 
IllegalPathException {
-    List<PartialPath> timeseriesPath = new ArrayList<>();
+    List<IFullPath> timeseriesPath = new ArrayList<>();
     for (int d = 0; d < deviceNum; d++) {
       for (int i = 0; i < measurementNum; i++) {
         TSDataType dataType = getDataType(i);
         if (!isAligned) {
           timeseriesPath.add(
-              new MeasurementPath(
-                  testStorageGroup + PATH_SEPARATOR + "d" + d + PATH_SEPARATOR 
+ "s" + i,
-                  dataType));
+              new NonAlignedFullPath(
+                  IDeviceID.Factory.DEFAULT_FACTORY.create(
+                      testStorageGroup + PATH_SEPARATOR + "d" + d),
+                  new MeasurementSchema("s" + i, dataType)));
         } else {
           timeseriesPath.add(
-              new AlignedPath(
-                  testStorageGroup + PATH_SEPARATOR + "d" + (10000 + d),
+              new AlignedFullPath(
+                  IDeviceID.Factory.DEFAULT_FACTORY.create(
+                      testStorageGroup + PATH_SEPARATOR + "d" + (10000 + d)),
                   Collections.singletonList("s" + i),
                   Collections.singletonList(new MeasurementSchema("s" + i, 
dataType))));
         }

Reply via email to