Skip to content

Commit

Permalink
[apache#6030] fix(CLI): Fix Setting the same tags multiple times in t…
Browse files Browse the repository at this point in the history
…he Gravitino CLi gives unexpected output (apache#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: apache#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
```
  • Loading branch information
Abyss-lord committed Jan 3, 2025
1 parent 352b43a commit 2221095
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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 {
Expand Down Expand Up @@ -94,6 +95,8 @@ public void handle() {
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());
}
Expand Down

0 comments on commit 2221095

Please sign in to comment.