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 e088c5574 [#5824] fix(CLI): Fix CLi throws an inappropriate exception
when table name is unknown in Gravitino CLI command (#5893)
e088c5574 is described below
commit e088c55740d76e97a3f86abef9331421c753f72f
Author: Lord of Abyss <[email protected]>
AuthorDate: Wed Dec 18 07:08:11 2024 +0800
[#5824] fix(CLI): Fix CLi throws an inappropriate exception when table name
is unknown in Gravitino CLI command (#5893)
### What changes were proposed in this pull request?
When using the column list command, the CLI should provide a hint rather
than throwing an exception if the table does not exist.
### Why are the changes needed?
Fix: #5824
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?

---
.../main/java/org/apache/gravitino/cli/commands/ListColumns.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git
a/clients/cli/src/main/java/org/apache/gravitino/cli/commands/ListColumns.java
b/clients/cli/src/main/java/org/apache/gravitino/cli/commands/ListColumns.java
index 9ea85a55e..f289fbe47 100644
---
a/clients/cli/src/main/java/org/apache/gravitino/cli/commands/ListColumns.java
+++
b/clients/cli/src/main/java/org/apache/gravitino/cli/commands/ListColumns.java
@@ -19,7 +19,10 @@
package org.apache.gravitino.cli.commands;
+import com.google.common.base.Joiner;
import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.cli.ErrorMessages;
+import org.apache.gravitino.exceptions.NoSuchTableException;
import org.apache.gravitino.rel.Column;
/** Displays the details of a table's columns. */
@@ -58,6 +61,10 @@ public class ListColumns extends TableCommand {
try {
NameIdentifier name = NameIdentifier.of(schema, table);
columns = tableCatalog().loadTable(name).columns();
+ } catch (NoSuchTableException noSuchTableException) {
+ System.err.println(
+ ErrorMessages.UNKNOWN_TABLE + Joiner.on(".").join(metalake, catalog,
schema, table));
+ return;
} catch (Exception exp) {
System.err.println(exp.getMessage());
return;