public static long calculateBatchDataRamBytesUsed(BatchData batchData) {
    long totalSizeInBytes = 0;

    // timestamp
    totalSizeInBytes += 8;

    // values
    final TSDataType type = batchData.getDataType();
    if (type != null) {
      if (type == TSDataType.VECTOR && batchData.getVector() != null) {
        for (int i = 0; i < batchData.getVector().length; ++i) {
          final TsPrimitiveType primitiveType = batchData.getVector()[i];
          if (primitiveType == null || primitiveType.getDataType() == null) {
            continue;
          }
          // consider variable references (plus 8) and memory alignment (round up to 8)
          totalSizeInBytes += roundUpToMultiple(primitiveType.getSize() + 8L, 8);
        }
      } else {
        if (type.isBinary()) {
          final Binary binary = batchData.getBinary();
          // refer to org.apache.tsfile.utils.TsPrimitiveType.TsBinary.getSize
          totalSizeInBytes +=
              roundUpToMultiple((binary == null ? 8 : binary.ramBytesUsed()) + 8L, 8);
        } else {
          totalSizeInBytes += roundUpToMultiple(TsPrimitiveType.getByType(type).getSize() + 8L, 8);
        }
      }
    }

    return batchData.length() * totalSizeInBytes;
  }
Given a row of a tablet, calculate the row count and memory cost of the pipe tablet that will
be constructed according to config.

@return left is the row count of tablet, right is the memory cost of tablet in bytes
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/PipeMemoryWeightUtil.java