From 9f151ab7258f05e8fbda8ad6cc5c92e241411de9 Mon Sep 17 00:00:00 2001 From: Fang Yong Date: Fri, 22 Dec 2023 14:27:21 +0800 Subject: [PATCH] [core] Support database path for specified database in catalog (#2494) --- .../apache/paimon/catalog/AbstractCatalog.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java index c01baa774aec..bc54516c82aa 100644 --- a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java +++ b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java @@ -294,7 +294,13 @@ private FileStoreTable getDataTable(Identifier identifier) throws TableNotExistE lineageMetaFactory)); } - @VisibleForTesting + /** + * Get warehouse path for specified database. If a catalog would like to provide individual path + * for each database, this method can be `Override` in that catalog. + * + * @param database The given database name + * @return The warehouse path for the database + */ public Path newDatabasePath(String database) { return newDatabasePath(warehouse(), database); } @@ -315,6 +321,11 @@ Map> allTablePaths() { } } + /** + * Get the warehouse path for the catalog if exists. + * + * @return The catalog warehouse path. + */ public abstract String warehouse(); public Map options() { @@ -326,7 +337,7 @@ protected abstract TableSchema getDataTableSchema(Identifier identifier) @VisibleForTesting public Path getDataTableLocation(Identifier identifier) { - return newTableLocation(warehouse(), identifier); + return new Path(newDatabasePath(identifier.getDatabaseName()), identifier.getObjectName()); } private static boolean isSpecifiedSystemTable(Identifier identifier) {