From 524dc0ab3ff3daa39d7a01ac7a06c265389af7b6 Mon Sep 17 00:00:00 2001 From: "jia.ouyang" <2360580200@qq.com> Date: Mon, 26 Feb 2024 16:32:34 +0800 Subject: [PATCH] add getDatabaseLocation method by HiveCatalog --- .../java/org/apache/paimon/hive/HiveCatalog.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java index 731c0935854c..0d1e6428220e 100644 --- a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java +++ b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java @@ -192,6 +192,20 @@ public Path getDataTableLocation(Identifier identifier) { throw new RuntimeException("Can not get table " + identifier + " from metastore.", e); } } + public Path getDatabaseLocation(String databaseName){ + try { + if (databaseExistsImpl(databaseName)) { + String location = + locationHelper.getDatabaseLocation(client.getDatabase(databaseName)); + if (location != null) { + return new Path(location); + } + } + } catch (TException e) { + throw new RuntimeException("Can not get database " + databaseName + " from metastore.", e); + } + return null; + } @Override public List listDatabases() {