This is an automated email from the ASF dual-hosted git repository.
fanng 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 bb4662f483 [#6771] fix(flink-connector): Optimize the error message
when unable to load the catalog while using Flink. (#6773)
bb4662f483 is described below
commit bb4662f4836c2302d362f20f35c5c80d13bfe668
Author: yangyang zhong <[email protected]>
AuthorDate: Thu Apr 3 14:58:35 2025 +0800
[#6771] fix(flink-connector): Optimize the error message when unable to
load the catalog while using Flink. (#6773)
### What changes were proposed in this pull request?
Optimize the error message when unable to load the catalog while using
Flink.
### Why are the changes needed?
Fix: #6771
### Does this PR introduce any user-facing change?
None
### How was this patch tested?
Use existing cases.
---
.../flink/connector/store/GravitinoCatalogStore.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git
a/flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/store/GravitinoCatalogStore.java
b/flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/store/GravitinoCatalogStore.java
index 4c29b7fde3..836f0fc056 100644
---
a/flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/store/GravitinoCatalogStore.java
+++
b/flink-connector/flink/src/main/java/org/apache/gravitino/flink/connector/store/GravitinoCatalogStore.java
@@ -35,6 +35,7 @@ import
org.apache.flink.table.catalog.exceptions.CatalogException;
import org.apache.flink.table.factories.Factory;
import org.apache.flink.util.Preconditions;
import org.apache.gravitino.Catalog;
+import org.apache.gravitino.exceptions.NoSuchCatalogException;
import org.apache.gravitino.flink.connector.PropertiesConverter;
import org.apache.gravitino.flink.connector.catalog.BaseCatalogFactory;
import org.apache.gravitino.flink.connector.catalog.GravitinoCatalogManager;
@@ -75,6 +76,13 @@ public class GravitinoCatalogStore extends
AbstractCatalogStore {
}
}
+ /**
+ * Get a catalog by name.
+ *
+ * @param catalogName name of the catalog to retrieve
+ * @return the requested catalog or empty if the catalog does not exist
+ * @throws CatalogException throw a CatalogException when the Catalog cannot
be created.
+ */
@Override
public Optional<CatalogDescriptor> getCatalog(String catalogName) throws
CatalogException {
try {
@@ -86,9 +94,10 @@ public class GravitinoCatalogStore extends
AbstractCatalogStore {
CatalogDescriptor descriptor =
CatalogDescriptor.of(catalogName,
Configuration.fromMap(flinkCatalogProperties));
return Optional.of(descriptor);
- } catch (Exception e) {
- LOG.warn("Failed to get the catalog:{}", catalogName, e);
+ } catch (NoSuchCatalogException noSuchCatalogException) {
return Optional.empty();
+ } catch (Exception e) {
+ throw new CatalogException(String.format("Failed to get the catalog:
%s", catalogName), e);
}
}