@SuppressWarnings("squid:S3776") // High Cognitive Complexity
  private long[] checkMemCostAndAddToTspInfoForRow(
      IDeviceID deviceId, String[] measurements, TSDataType[] dataTypes, Object[] values)
      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;

    for (int i = 0; i < dataTypes.length; i++) {
      // Skip failed Measurements
      if (dataTypes[i] == null || measurements[i] == null) {
        continue;
      }
      IWritableMemChunk memChunk = workMemTable.getWritableMemChunk(deviceId, measurements[i]);
      if (memChunk == null) {
        // ChunkMetadataIncrement
        chunkMetadataIncrement += ChunkMetadata.calculateRamSize(measurements[i], dataTypes[i]);
        memTableIncrement += TVList.tvListArrayMemCost(dataTypes[i]);
      } else {
        // here currentChunkPointNum >= 1
        long currentChunkPointNum = memChunk.rowCount();
        if (currentChunkPointNum % PrimitiveArrayManager.ARRAY_SIZE == 0) {
          memTableIncrement += memChunk.getWorkingTVList().tvListArrayMemCost();
        }
      }
      // TEXT data mem size
      if (dataTypes[i].isBinary() && values[i] != null) {
        textDataIncrement += MemUtils.getBinarySize((Binary) values[i]);
      }
    }
    updateMemoryInfo(memTableIncrement, chunkMetadataIncrement, textDataIncrement);
    return new long[] {memTableIncrement, textDataIncrement, chunkMetadataIncrement};
  }
Insert batch data of insertTabletPlan into the workingMemtable. The rows to be inserted are in
the range [start, end). Null value in each column values will be replaced by the subsequent
non-null value, e.g., {1, null, 3, null, 5} will be {1, 3, 5, null, 5}

@param insertTabletNode insert a tablet of a device
@param rangeList start and end index list of rows to be inserted in insertTabletPlan
@param results result array
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java