Skip to content

Commit

Permalink
[core] Support database path for specified database in catalog (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
FangYongs authored Dec 22, 2023
1 parent 7e7b656 commit 9f151ab
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -315,6 +321,11 @@ Map<String, Map<String, Path>> allTablePaths() {
}
}

/**
* Get the warehouse path for the catalog if exists.
*
* @return The catalog warehouse path.
*/
public abstract String warehouse();

public Map<String, String> options() {
Expand All @@ -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) {
Expand Down

0 comments on commit 9f151ab

Please sign in to comment.