diff --git a/api/src/main/java/org/apache/gravitino/file/FilesetChange.java b/api/src/main/java/org/apache/gravitino/file/FilesetChange.java index 2df992ece5b..ae694a01d42 100644 --- a/api/src/main/java/org/apache/gravitino/file/FilesetChange.java +++ b/api/src/main/java/org/apache/gravitino/file/FilesetChange.java @@ -74,6 +74,7 @@ static FilesetChange removeProperty(String property) { * * @return The fileset change. */ + @Deprecated static FilesetChange removeComment() { return RemoveComment.getInstance(); } @@ -310,7 +311,11 @@ public String toString() { } } - /** A fileset change to remove comment from the fileset. */ + /** + * A fileset change to remove comment from the fileset. + * The remove operation has been replaced by the update operation. Please use the update operation. + */ + @Deprecated final class RemoveComment implements FilesetChange { private static final RemoveComment INSTANCE = new RemoveComment(); diff --git a/clients/client-python/gravitino/api/fileset_change.py b/clients/client-python/gravitino/api/fileset_change.py index 2be9bc56804..cfaa78e0d0e 100644 --- a/clients/client-python/gravitino/api/fileset_change.py +++ b/clients/client-python/gravitino/api/fileset_change.py @@ -81,6 +81,9 @@ def remove_comment(): Returns: The fileset change. + + Deprecated: + This class is deprecated and will be removed in future versions. """ return FilesetChange.RemoveComment() @@ -279,7 +282,11 @@ def __str__(self): @dataclass class RemoveComment: - """A fileset change to remove comment from the fileset.""" + """A fileset change to remove comment from the fileset. + + Deprecated: + This class is deprecated and will be removed in future versions. + """ def __eq__(self, other) -> bool: """Compares this RemoveComment instance with another object for equality. diff --git a/clients/client-python/gravitino/dto/requests/catalog_update_request.py b/clients/client-python/gravitino/dto/requests/catalog_update_request.py index 1164db2990b..1ea4d9953c0 100644 --- a/clients/client-python/gravitino/dto/requests/catalog_update_request.py +++ b/clients/client-python/gravitino/dto/requests/catalog_update_request.py @@ -78,8 +78,8 @@ def catalog_change(self): return CatalogChange.update_comment(self._new_comment) def validate(self): - if not self._new_comment: - raise ValueError('"newComment" field is required and cannot be empty') + """Validates the fields of the request. Always pass.""" + pass @dataclass class SetCatalogPropertyRequest(CatalogUpdateRequestBase): diff --git a/clients/client-python/gravitino/dto/requests/fileset_update_request.py b/clients/client-python/gravitino/dto/requests/fileset_update_request.py index 66e001bee9c..542a1843937 100644 --- a/clients/client-python/gravitino/dto/requests/fileset_update_request.py +++ b/clients/client-python/gravitino/dto/requests/fileset_update_request.py @@ -79,13 +79,8 @@ def __init__(self, new_comment: str): self._new_comment = new_comment def validate(self): - """Validates the fields of the request. - - Raises: - IllegalArgumentException if the new comment is not set. - """ - if not self._new_comment: - raise ValueError('"new_comment" field is required and cannot be empty') + """Validates the fields of the request. Always pass.""" + pass def fileset_change(self): """Returns the fileset change""" @@ -149,7 +144,11 @@ def fileset_change(self): @dataclass class RemoveFilesetCommentRequest(FilesetUpdateRequestBase): - """Represents a request to remove comment from a Fileset.""" + """Represents a request to remove comment from a Fileset. + + Deprecated: + This class is deprecated and will be removed in future versions. + """ def __init__(self): super().__init__("removeComment") diff --git a/clients/client-python/gravitino/dto/requests/metalake_update_request.py b/clients/client-python/gravitino/dto/requests/metalake_update_request.py index 8e54fe360e1..79551e5dc0d 100644 --- a/clients/client-python/gravitino/dto/requests/metalake_update_request.py +++ b/clients/client-python/gravitino/dto/requests/metalake_update_request.py @@ -74,13 +74,8 @@ def __init__(self, new_comment: str): self._new_comment = new_comment def validate(self): - """Validates the fields of the request. - - Raises: - IllegalArgumentException if the new comment is not set. - """ - if not self._new_comment: - raise ValueError('"newComment" field is required and cannot be empty') + """Validates the fields of the request. Always pass.""" + pass def metalake_change(self): return MetalakeChange.update_comment(self._new_comment) diff --git a/common/src/main/java/org/apache/gravitino/dto/requests/CatalogUpdateRequest.java b/common/src/main/java/org/apache/gravitino/dto/requests/CatalogUpdateRequest.java index 9dfbb4efd2f..aabdf2901fa 100644 --- a/common/src/main/java/org/apache/gravitino/dto/requests/CatalogUpdateRequest.java +++ b/common/src/main/java/org/apache/gravitino/dto/requests/CatalogUpdateRequest.java @@ -117,17 +117,9 @@ public UpdateCatalogCommentRequest() { this(null); } - /** - * Validates the fields of the request. - * - * @throws IllegalArgumentException if the new comment is not set. - */ + /** Validates the fields of the request. Always pass. */ @Override - public void validate() throws IllegalArgumentException { - Preconditions.checkArgument( - StringUtils.isNotBlank(newComment), - "\"newComment\" field is required and cannot be empty"); - } + public void validate() throws IllegalArgumentException {} @Override public CatalogChange catalogChange() { diff --git a/common/src/main/java/org/apache/gravitino/dto/requests/FilesetUpdateRequest.java b/common/src/main/java/org/apache/gravitino/dto/requests/FilesetUpdateRequest.java index c7aa79cb800..d2d5f1f441f 100644 --- a/common/src/main/java/org/apache/gravitino/dto/requests/FilesetUpdateRequest.java +++ b/common/src/main/java/org/apache/gravitino/dto/requests/FilesetUpdateRequest.java @@ -109,17 +109,9 @@ public FilesetChange filesetChange() { return FilesetChange.updateComment(newComment); } - /** - * Validates the request. - * - * @throws IllegalArgumentException if the request is invalid. - */ + /** Validates the fields of the request. Always pass. */ @Override - public void validate() throws IllegalArgumentException { - Preconditions.checkArgument( - StringUtils.isNotBlank(newComment), - "\"newComment\" field is required and cannot be empty"); - } + public void validate() throws IllegalArgumentException {} } /** The fileset update request for setting the properties of a fileset. */ @@ -189,6 +181,7 @@ public void validate() throws IllegalArgumentException { @EqualsAndHashCode @NoArgsConstructor(force = true) @ToString + @Deprecated class RemoveFilesetCommentRequest implements FilesetUpdateRequest { /** @return The fileset change. */ diff --git a/common/src/main/java/org/apache/gravitino/dto/requests/MetalakeUpdateRequest.java b/common/src/main/java/org/apache/gravitino/dto/requests/MetalakeUpdateRequest.java index a5b747aff77..6e01ace8052 100644 --- a/common/src/main/java/org/apache/gravitino/dto/requests/MetalakeUpdateRequest.java +++ b/common/src/main/java/org/apache/gravitino/dto/requests/MetalakeUpdateRequest.java @@ -117,17 +117,9 @@ public UpdateMetalakeCommentRequest() { this(null); } - /** - * Validates the fields of the request. - * - * @throws IllegalArgumentException if the new comment is not set. - */ + /** Validates the fields of the request. Always pass. */ @Override - public void validate() throws IllegalArgumentException { - Preconditions.checkArgument( - StringUtils.isNotBlank(newComment), - "\"newComment\" field is required and cannot be empty"); - } + public void validate() throws IllegalArgumentException {} @Override public MetalakeChange metalakeChange() { diff --git a/common/src/main/java/org/apache/gravitino/dto/requests/TableUpdateRequest.java b/common/src/main/java/org/apache/gravitino/dto/requests/TableUpdateRequest.java index 936597f4dad..db1702ce6de 100644 --- a/common/src/main/java/org/apache/gravitino/dto/requests/TableUpdateRequest.java +++ b/common/src/main/java/org/apache/gravitino/dto/requests/TableUpdateRequest.java @@ -164,17 +164,9 @@ public UpdateTableCommentRequest() { this(null); } - /** - * Validates the request. - * - * @throws IllegalArgumentException If the request is invalid, this exception is thrown. - */ + /** Validates the fields of the request. Always pass. */ @Override - public void validate() throws IllegalArgumentException { - Preconditions.checkArgument( - StringUtils.isNotBlank(newComment), - "\"newComment\" field is required and cannot be empty"); - } + public void validate() throws IllegalArgumentException {} /** * Returns the table change. diff --git a/common/src/main/java/org/apache/gravitino/dto/requests/TagUpdateRequest.java b/common/src/main/java/org/apache/gravitino/dto/requests/TagUpdateRequest.java index 5323ac56548..f27d8359e71 100644 --- a/common/src/main/java/org/apache/gravitino/dto/requests/TagUpdateRequest.java +++ b/common/src/main/java/org/apache/gravitino/dto/requests/TagUpdateRequest.java @@ -114,11 +114,9 @@ public TagChange tagChange() { return TagChange.updateComment(newComment); } + /** Validates the fields of the request. Always pass. */ @Override - public void validate() throws IllegalArgumentException { - Preconditions.checkArgument( - StringUtils.isNotBlank(newComment), "\"newComment\" must not be blank"); - } + public void validate() throws IllegalArgumentException {} } /** The tag update request for setting a tag property. */ diff --git a/common/src/main/java/org/apache/gravitino/dto/requests/TopicUpdateRequest.java b/common/src/main/java/org/apache/gravitino/dto/requests/TopicUpdateRequest.java index 67103b2e5df..add5ae7e99b 100644 --- a/common/src/main/java/org/apache/gravitino/dto/requests/TopicUpdateRequest.java +++ b/common/src/main/java/org/apache/gravitino/dto/requests/TopicUpdateRequest.java @@ -72,17 +72,9 @@ public UpdateTopicCommentRequest() { this(null); } - /** - * Validates the request. - * - * @throws IllegalArgumentException If the request is invalid, this exception is thrown. - */ + /** Validates the fields of the request. Always pass. */ @Override - public void validate() throws IllegalArgumentException { - Preconditions.checkArgument( - StringUtils.isNotBlank(newComment), - "\"newComment\" field is required and cannot be empty"); - } + public void validate() throws IllegalArgumentException {} /** * Returns the topic change. diff --git a/docs/manage-fileset-metadata-using-gravitino.md b/docs/manage-fileset-metadata-using-gravitino.md index 22b12f5b1a7..475a5b18d3d 100644 --- a/docs/manage-fileset-metadata-using-gravitino.md +++ b/docs/manage-fileset-metadata-using-gravitino.md @@ -389,13 +389,13 @@ fileset_new = catalog.as_fileset_catalog().alter_fileset(NameIdentifier.of("sche Currently, Gravitino supports the following changes to a fileset: -| Supported modification | JSON | Java | -|----------------------------|--------------------------------------------------------------|-----------------------------------------------| -| Rename a fileset | `{"@type":"rename","newName":"fileset_renamed"}` | `FilesetChange.rename("fileset_renamed")` | -| Update a comment | `{"@type":"updateComment","newComment":"new_comment"}` | `FilesetChange.updateComment("new_comment")` | -| Set a fileset property | `{"@type":"setProperty","property":"key1","value":"value1"}` | `FilesetChange.setProperty("key1", "value1")` | -| Remove a fileset property | `{"@type":"removeProperty","property":"key1"}` | `FilesetChange.removeProperty("key1")` | -| Remove comment | `{"@type":"removeComment"}` | `FilesetChange.removeComment()` | +| Supported modification | JSON | Java | +|-----------------------------|--------------------------------------------------------------|-----------------------------------------------| +| Rename a fileset | `{"@type":"rename","newName":"fileset_renamed"}` | `FilesetChange.rename("fileset_renamed")` | +| Update a comment | `{"@type":"updateComment","newComment":"new_comment"}` | `FilesetChange.updateComment("new_comment")` | +| Set a fileset property | `{"@type":"setProperty","property":"key1","value":"value1"}` | `FilesetChange.setProperty("key1", "value1")` | +| Remove a fileset property | `{"@type":"removeProperty","property":"key1"}` | `FilesetChange.removeProperty("key1")` | +| Remove comment (deprecated) | `{"@type":"removeComment"}` | `FilesetChange.removeComment()` | ### Drop a fileset