Caideyipi commented on code in PR #16699:
URL: https://github.com/apache/iotdb/pull/16699#discussion_r2544683985


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertTabletStatement.java:
##########
@@ -611,6 +611,45 @@ public void swapColumn(int src, int target) {
     deviceIDs = null;
   }
 
+  @Override
+  public void rebuildArraysAfterExpansion(final int[] oldToNewMapping, final 
int totalTagCount) {
+    final int oldLength = oldToNewMapping.length;
+    final int newLength = measurements.length;
+
+    // Save old arrays
+    final Object[] oldColumns = columns;
+    final BitMap[] oldNullBitMaps = nullBitMaps;
+
+    // Create new arrays: [TAG area: 0~totalTagCount] + [non-TAG area: 
totalTagCount~newLength]
+    columns = new Object[newLength];
+    nullBitMaps = oldNullBitMaps != null ? new BitMap[newLength] : null;
+
+    // Initialize all TAG columns with default empty arrays (STRING type)
+    for (int tagIdx = 0; tagIdx < totalTagCount; tagIdx++) {
+      columns[tagIdx] =
+          CommonUtils.createValueColumnOfDataType(
+              TSDataType.STRING, TsTableColumnCategory.TAG, rowCount);
+      if (nullBitMaps != null) {
+        nullBitMaps[tagIdx] = new BitMap(rowCount);
+        // Mark all as null initially (will be overwritten if data exists)
+        for (int row = 0; row < rowCount; row++) {
+          nullBitMaps[tagIdx].mark(row);

Review Comment:
   Why not use "markAll", and 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to