This is an automated email from the ASF dual-hosted git repository.

jmclean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new fb7561698 [#6030] fix(CLI): Fix Setting the same tags multiple times 
in the Gravitino CLi gives unexpected output (#6037)
fb7561698 is described below

commit fb756169805d1f0164641cdd475228f6b7ead730
Author: Lord of Abyss <103809695+abyss-l...@users.noreply.github.com>
AuthorDate: Fri Jan 3 07:58:53 2025 +0800

    [#6030] fix(CLI): Fix Setting the same tags multiple times in the Gravitino 
CLi gives unexpected output (#6037)
    
    ### What changes were proposed in this pull request?
    
    Fix the error information when Setting the same tags multiple times in
    the Gravitino CLi. now a hint information is given when the tag is set
    repeatedly
    
    ### Why are the changes needed?
    
    Fix: #6030
    
    ### Does this PR introduce _any_ user-facing change?
    
    NO
    
    ### How was this patch tested?
    
    ```bash
    gcli tag set --metalake demo_metalake --name Hive_catalog --tag tagB tagC
    # Hive_catalog now tagged with tagB,tagC
    
    gcli tag set --metalake demo_metalake --name Hive_catalog --tag tagB tagC
    # [tagB, tagC] are(is) already associated with Hive_catalog
    ```
---
 .../cli/src/main/java/org/apache/gravitino/cli/commands/TagEntity.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/clients/cli/src/main/java/org/apache/gravitino/cli/commands/TagEntity.java 
b/clients/cli/src/main/java/org/apache/gravitino/cli/commands/TagEntity.java
index d2d1cbbe1..7bc8ec376 100644
--- a/clients/cli/src/main/java/org/apache/gravitino/cli/commands/TagEntity.java
+++ b/clients/cli/src/main/java/org/apache/gravitino/cli/commands/TagEntity.java
@@ -29,6 +29,7 @@ import org.apache.gravitino.exceptions.NoSuchCatalogException;
 import org.apache.gravitino.exceptions.NoSuchMetalakeException;
 import org.apache.gravitino.exceptions.NoSuchSchemaException;
 import org.apache.gravitino.exceptions.NoSuchTableException;
+import org.apache.gravitino.exceptions.TagAlreadyAssociatedException;
 import org.apache.gravitino.rel.Table;
 
 public class TagEntity extends Command {
@@ -94,6 +95,8 @@ public class TagEntity extends Command {
       exitWithError(ErrorMessages.UNKNOWN_SCHEMA);
     } catch (NoSuchTableException err) {
       exitWithError(ErrorMessages.UNKNOWN_TABLE);
+    } catch (TagAlreadyAssociatedException err) {
+      exitWithError("Tags are already associated with " + name.getName());
     } catch (Exception exp) {
       exitWithError(exp.getMessage());
     }

Reply via email to