public TableMetaBuilder withPrimaryKeySpec(PrimaryKeySpec keySpec) {
      if (keySpec == null) {
        return this;
      }
      org.apache.amoro.api.PrimaryKeySpec primaryKeySpec =
          new org.apache.amoro.api.PrimaryKeySpec();
      List<String> fields =
          keySpec.primaryKeyStruct().fields().stream()
              .map(Types.NestedField::name)
              .collect(Collectors.toList());
      primaryKeySpec.setFields(fields);
      meta.setKeySpec(primaryKeySpec);
      return this;
    }
Util class convert types to metastore api structs.
amoro-format-iceberg/src/main/java/org/apache/amoro/utils/ConvertStructUtil.java