You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "xiaozcy (via GitHub)" <gi...@apache.org> on 2025/06/03 09:30:55 UTC

[PR] [#7307] improvement(model): support list model versions with full information [gravitino]

xiaozcy opened a new pull request, #7325:
URL: https://github.com/apache/gravitino/pull/7325

   ### What changes were proposed in this pull request?
   
   Support list model versions with full information.
   
   ### Why are the changes needed?
   
   Fix: #7307 
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes.
   
   ### How was this patch tested?
   
   UT & IT.
   


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#issuecomment-2944994646

   Can you also update the related doc if necessary, also the openAPI doc to add new query parameter?


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on code in PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#discussion_r2127029793


##########
api/src/main/java/org/apache/gravitino/model/ModelCatalog.java:
##########
@@ -136,6 +136,16 @@ default Model registerModel(
    */
   int[] listModelVersions(NameIdentifier ident) throws NoSuchModelException;
 
+  /**
+   * List all the versions with their information of the register model by {@link NameIdentifier} in
+   * the catalog.
+   *
+   * @param ident The name identifier of the model.
+   * @return An array of version information of the model.
+   * @throws NoSuchModelException If the model does not exist.
+   */
+  ModelVersion[] listModelVersionsInfo(NameIdentifier ident) throws NoSuchModelException;

Review Comment:
   Can you please update the method name to `listModelVersionInfos`



##########
catalogs/catalog-model/src/main/java/org/apache/gravitino/catalog/model/ModelCatalogOperations.java:
##########
@@ -187,6 +187,23 @@ public int[] listModelVersions(NameIdentifier ident) throws NoSuchModelException
     }
   }
 
+  @Override
+  public ModelVersion[] listModelVersionsInfo(NameIdentifier ident) throws NoSuchModelException {
+    NameIdentifierUtil.checkModel(ident);
+    Namespace modelVersionNs = NamespaceUtil.toModelVersionNs(ident);
+
+    try {
+      List<ModelVersionEntity> versions =
+          store.list(modelVersionNs, ModelVersionEntity.class, Entity.EntityType.MODEL_VERSION);
+      return versions.stream().map(this::toModelVersionImpl).toArray(ModelVersion[]::new);
+
+    } catch (NoSuchEntityException e) {
+      throw new NoSuchModelException(e, "Model %s does not exist", ident);
+    } catch (IOException ioe) {
+      throw new RuntimeException("Failed to list model versions for model " + ident, ioe);

Review Comment:
   "Failed to list model version infos for model ".



##########
common/src/main/java/org/apache/gravitino/dto/responses/ModelVersionListResponse.java:
##########
@@ -31,14 +32,14 @@
 public class ModelVersionListResponse extends BaseResponse {
 
   @JsonProperty("versions")

Review Comment:
   We're using same json key `versions` for both `modelVersionListResponse` and `modelVersionNumberListResponse`. I'm afraid some deserialization methods will be confused when deserializing from JSON, which class should we call?
   
   Also, it may introduce the compatibility issue. For example, if someone uses REST APIs and they already uses `versions`, not `versions` has another meaning, how do they differentiate? 
   
   I would suggest to use a different name like "infos", what do you think?



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "xiaozcy (via GitHub)" <gi...@apache.org>.
xiaozcy commented on PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#issuecomment-2948255948

   > @xiaozcy can you please fix the CI issue?
   
   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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "xiaozcy (via GitHub)" <gi...@apache.org>.
xiaozcy commented on PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#issuecomment-2938136351

   @jerryshao, can you please help review this?


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao merged PR #7325:
URL: https://github.com/apache/gravitino/pull/7325


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "xiaozcy (via GitHub)" <gi...@apache.org>.
xiaozcy commented on PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#issuecomment-2942587482

   @jerryshao Comments above are already resolved.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on code in PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#discussion_r2127052173


##########
common/src/main/java/org/apache/gravitino/dto/responses/ModelVersionListResponse.java:
##########
@@ -31,14 +32,14 @@
 public class ModelVersionListResponse extends BaseResponse {
 
   @JsonProperty("versions")

Review Comment:
   We're using same json key `versions` for both `modelVersionListResponse` and `modelVersionNumberListResponse`. I'm afraid some deserialization methods will be confused when deserializing from JSON, which class should we call?
   
   Also, it may introduce the compatibility issue. For example, if someone uses REST APIs and they already uses `versions`, now `versions` has another meaning, how do they differentiate? 
   
   I would suggest to use a different name like "infos", what do you think?



-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "xiaozcy (via GitHub)" <gi...@apache.org>.
xiaozcy commented on PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#issuecomment-2947906073

   Docs have been updated.


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [#7307] improvement(model): support list model versions with full information [gravitino]

Posted by "jerryshao (via GitHub)" <gi...@apache.org>.
jerryshao commented on PR #7325:
URL: https://github.com/apache/gravitino/pull/7325#issuecomment-2948170790

   @xiaozcy can you please fix the CI issue?


-- 
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: commits-unsubscribe@gravitino.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org