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

jt2594838 pushed a commit to branch add_flat_device
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit b6128e7a59042ffa812f8369e7c1e81ca9a31d51
Author: Tian Jiang <[email protected]>
AuthorDate: Tue Sep 22 16:49:24 2026 +0800

    tmp
---
 .../dataregion/memtable/AbstractMemTable.java      | 10 ++++++----
 .../memtable/AlignedWritableMemChunk.java          | 10 +++++++++-
 .../utils/datastructure/AlignedTVListFactory.java  | 22 +++++++++++++++++++++-
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
index c5902b738df..0919a70906a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
@@ -1161,7 +1161,8 @@ public abstract class AbstractMemTable implements 
IMemTable {
       IWritableMemChunkGroup memChunkGroup;
       if (multiTvListInMemChunk) {
         if (isAligned) {
-          memChunkGroup = AlignedWritableMemChunkGroup.deserialize(stream, 
deviceID.isTableModel());
+          memChunkGroup =
+              AlignedWritableMemChunkGroup.deserialize(stream, 
deviceID.isTableModel(), deviceID);
         } else {
           memChunkGroup = WritableMemChunkGroup.deserialize(stream);
         }
@@ -1169,7 +1170,7 @@ public abstract class AbstractMemTable implements 
IMemTable {
         if (isAligned) {
           memChunkGroup =
               AlignedWritableMemChunkGroup.deserializeSingleTVListMemChunks(
-                  stream, deviceID.isTableModel());
+                  stream, deviceID.isTableModel(), deviceID);
         } else {
           memChunkGroup = 
WritableMemChunkGroup.deserializeSingleTVListMemChunks(stream);
         }
@@ -1204,7 +1205,8 @@ public abstract class AbstractMemTable implements 
IMemTable {
       IWritableMemChunkGroup memChunkGroup;
       if (multiTvListInMemChunk) {
         if (isAligned) {
-          memChunkGroup = AlignedWritableMemChunkGroup.deserialize(stream, 
deviceID.isTableModel());
+          memChunkGroup =
+              AlignedWritableMemChunkGroup.deserialize(stream, 
deviceID.isTableModel(), deviceID);
         } else {
           memChunkGroup = WritableMemChunkGroup.deserialize(stream);
         }
@@ -1212,7 +1214,7 @@ public abstract class AbstractMemTable implements 
IMemTable {
         if (isAligned) {
           memChunkGroup =
               AlignedWritableMemChunkGroup.deserializeSingleTVListMemChunks(
-                  stream, deviceID.isTableModel());
+                  stream, deviceID.isTableModel(), deviceID);
         } else {
           memChunkGroup = 
WritableMemChunkGroup.deserializeSingleTVListMemChunks(stream);
         }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
index 1c04b805f6e..41d8d2f7e62 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
@@ -44,6 +44,7 @@ import org.apache.tsfile.common.conf.TSFileConfig;
 import org.apache.tsfile.encrypt.EncryptParameter;
 import org.apache.tsfile.encrypt.EncryptUtils;
 import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.file.metadata.IDeviceID;
 import org.apache.tsfile.read.common.TimeRange;
 import org.apache.tsfile.read.filter.basic.Filter;
 import org.apache.tsfile.utils.Binary;
@@ -84,6 +85,7 @@ public class AlignedWritableMemChunk extends 
AbstractWritableMemChunk {
   // TAG columns are appended physically, so their logical key order is 
tracked separately.
   private final List<Integer> sortColumnIndices;
   private final boolean useColumnSortedList;
+  private final IDeviceID physicalDeviceId;
 
   private static final IoTDBConfig CONFIG = 
IoTDBDescriptor.getInstance().getConfig();
   private final int TVLIST_SORT_THRESHOLD = CONFIG.getTvListSortThreshold();
@@ -108,9 +110,11 @@ public class AlignedWritableMemChunk extends 
AbstractWritableMemChunk {
         isTableModel,
         createContiguousSortColumnIndices(sortColumnCount),
         useColumnSortedList,
+        null,
         EncryptUtils.getEncryptParameter());
   }
 
+  @TestOnly
   public AlignedWritableMemChunk(
       List<IMeasurementSchema> schemaList,
       boolean isTableModel,
@@ -121,6 +125,7 @@ public class AlignedWritableMemChunk extends 
AbstractWritableMemChunk {
         isTableModel,
         sortColumnIndices,
         useColumnSortedList,
+        null,
         EncryptUtils.getEncryptParameter());
   }
 
@@ -142,14 +147,16 @@ public class AlignedWritableMemChunk extends 
AbstractWritableMemChunk {
         isTableModel,
         createContiguousSortColumnIndices(sortColumnCount),
         useColumnSortedList,
+        null,
         encryptParameter);
   }
 
-  private AlignedWritableMemChunk(
+  AlignedWritableMemChunk(
       List<IMeasurementSchema> schemaList,
       boolean isTableModel,
       List<Integer> sortColumnIndices,
       boolean useColumnSortedList,
+      IDeviceID physicalDeviceId,
       EncryptParameter encryptParameter) {
     this.measurementIndexMap = new LinkedHashMap<>();
     this.measurementCategoryMap = new LinkedHashMap<>();
@@ -159,6 +166,7 @@ public class AlignedWritableMemChunk extends 
AbstractWritableMemChunk {
     // Keep the chunk's schema order mutable because late schema discovery may 
append a TAG.
     this.schemaList = new ArrayList<>(schemaList);
     this.useColumnSortedList = useColumnSortedList;
+    this.physicalDeviceId = physicalDeviceId;
     for (int i = 0; i < schemaList.size(); i++) {
       measurementIndexMap.put(schemaList.get(i).getMeasurementName(), i);
       if (this.sortColumnIndices.contains(i)) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVListFactory.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVListFactory.java
index aa81aa3a74a..202e74ac833 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVListFactory.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVListFactory.java
@@ -19,12 +19,14 @@
 
 package org.apache.iotdb.db.utils.datastructure;
 
+import org.apache.iotdb.commons.utils.TestOnly;
 import org.apache.tsfile.enums.TSDataType;
 import org.apache.tsfile.file.metadata.IDeviceID;
 
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.util.List;
+import java.util.Objects;
 
 import static 
org.apache.iotdb.db.storageengine.rescon.memory.PrimitiveArrayManager.TVLIST_SORT_ALGORITHM;
 
@@ -66,11 +68,29 @@ public final class AlignedTVListFactory {
     return new FlatDeviceAlignedTVList(dataTypes, tagIndices, true);
   }
 
+  public static AlignedTVList createFlatDeviceAlignedList(
+      List<TSDataType> dataTypes, List<Integer> tagIndices, IDeviceID 
physicalDeviceId) {
+    Objects.requireNonNull(physicalDeviceId);
+    return new FlatDeviceAlignedTVList(
+        dataTypes, tagIndices, true, physicalDeviceId.getTableName());
+  }
+
+  @TestOnly
   public static AlignedTVList deserialize(DataInputStream stream) throws 
IOException {
+    return deserialize(stream, null);
+  }
+
+  public static AlignedTVList deserialize(DataInputStream stream, IDeviceID 
physicalDeviceId)
+      throws IOException {
     byte encodedDataType = stream.readByte();
     int dataTypeCount = stream.readInt();
     if (encodedDataType == FlatDeviceAlignedTVList.WAL_DATA_TYPE_MARKER) {
-      return ColumnSortedAlignedTVList.deserialize(stream, dataTypeCount, 
true);
+      return ColumnSortedAlignedTVList.deserialize(
+          stream,
+          dataTypeCount,
+          true,
+          // null for test compatibility
+          physicalDeviceId == null ? "" : physicalDeviceId.getTableName());
     }
     // The dedicated marker is the only discriminator for the column-sorted 
WAL format. VECTOR
     // continues to identify the ordinary AlignedTVList format; its count is 
never overloaded.

Reply via email to