public static long calculateTableSchemaBytesUsed(TableSchema tableSchema) {
    long totalSizeInBytes = 0;

    final String tableName = tableSchema.getTableName();
    if (tableName != null) {
      totalSizeInBytes += tableName.length();
    }

    final List<IMeasurementSchema> measurementSchemas = tableSchema.getColumnSchemas();
    if (measurementSchemas != null) {
      totalSizeInBytes +=
          NUM_BYTES_ARRAY_HEADER + (long) NUM_BYTES_OBJECT_REF * measurementSchemas.size();
      for (IMeasurementSchema measurementSchema : measurementSchemas) {
        InsertNodeMemoryEstimator.sizeOfMeasurementSchema((MeasurementSchema) measurementSchema);
      }
    }

    final List<ColumnCategory> categories = tableSchema.getColumnTypes();
    if (categories != null) {
      totalSizeInBytes +=
          alignObjectSize(
              (long) NUM_BYTES_ARRAY_HEADER
                  + (long) NUM_BYTES_OBJECT_REF * (long) categories.size());
    }

    return 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