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

majin1102 pushed a commit to branch emr/hms-namespace-explorer
in repository https://gitbox.apache.org/repos/asf/amoro.git

commit 0d2903c8a4316f333ed674dd17ed81f1f8097d54
Author: majin.nathan <[email protected]>
AuthorDate: Tue Aug 4 10:49:45 2026 +0800

    fix: preserve Hive 2 catalog compatibility
---
 .../main/java/org/apache/amoro/hive/HMSClientImpl.java  | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/amoro-common/src/main/java/org/apache/amoro/hive/HMSClientImpl.java 
b/amoro-common/src/main/java/org/apache/amoro/hive/HMSClientImpl.java
index 01b2e3de7..0c22e312a 100644
--- a/amoro-common/src/main/java/org/apache/amoro/hive/HMSClientImpl.java
+++ b/amoro-common/src/main/java/org/apache/amoro/hive/HMSClientImpl.java
@@ -32,6 +32,9 @@ import java.util.List;
 
 public class HMSClientImpl implements HMSClient {
 
+  private static final DynMethods.UnboundMethod GET_CATALOGS =
+      
DynMethods.builder("getCatalogs").impl(HiveMetaStoreClient.class).orNoop().build();
+
   private final HiveMetaStoreClient client;
 
   public HMSClientImpl(HiveMetaStoreClient client) {
@@ -190,6 +193,18 @@ public class HMSClientImpl implements HMSClient {
 
   @Override
   public List<String> getCatalogs() throws TException {
-    return getClient().getCatalogs();
+    if (GET_CATALOGS.isNoop()) {
+      throw new MetaException("Listing HMS catalogs requires Hive Metastore 3 
or later");
+    }
+
+    try {
+      return GET_CATALOGS.invokeChecked(getClient());
+    } catch (TException e) {
+      throw e;
+    } catch (Exception e) {
+      TException failure = new TException("Failed to list HMS catalogs");
+      failure.initCause(e);
+      throw failure;
+    }
   }
 }

Reply via email to