HTHou commented on code in PR #12720:
URL: https://github.com/apache/iotdb/pull/12720#discussion_r1758667757


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java:
##########
@@ -561,55 +557,163 @@ private long[] checkMemCostAndAddToTspInfoForRow(
     return new long[] {memTableIncrement, textDataIncrement, 
chunkMetadataIncrement};
   }
 
-  @SuppressWarnings("squid:S3776") // High Cognitive Complexity
   private long[] checkMemCostAndAddToTspInfoForRows(InsertRowsNode 
insertRowsNode)
       throws WriteProcessException {
-    // Memory of increased PrimitiveArray and TEXT values, e.g., add a 
long[128], add 128*8
-    long memTableIncrement = 0L;
-    long textDataIncrement = 0L;
-    long chunkMetadataIncrement = 0L;
+
+    long[] memIncrements = new long[3];
     // device -> measurement -> adding TVList size
-    Map<IDeviceID, Map<String, Integer>> increasingMemTableInfo = new 
HashMap<>();
+    Map<IDeviceID, Map<String, Integer>> increasingMemTableInfoForNonAligned = 
new HashMap<>();
+    // device -> (measurements -> datatype, adding aligned TVList size)
+    Map<IDeviceID, Pair<Map<String, TSDataType>, Integer>> 
increasingMemTableInfoForAligned =
+        new HashMap<>();
     for (InsertRowNode insertRowNode : insertRowsNode.getInsertRowNodeList()) {
-      IDeviceID deviceId = insertRowNode.getDeviceID();
-      TSDataType[] dataTypes = insertRowNode.getDataTypes();
-      Object[] values = insertRowNode.getValues();
-      String[] measurements = insertRowNode.getMeasurements();
+      if (insertRowNode.isAligned()) {
+        handleAlignedData(insertRowNode, memIncrements, 
increasingMemTableInfoForAligned);
+      } else {
+        handleUnalignedData(insertRowNode, memIncrements, 
increasingMemTableInfoForNonAligned);
+      }
+    }
+    updateMemoryInfo(memIncrements[0], memIncrements[2], memIncrements[1]);
+    return memIncrements;
+  }
+
+  @SuppressWarnings("squid:S3776") // High Cognitive Complexity
+  private void handleAlignedData(

Review Comment:
   fixed



-- 
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