Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[schema] Support database path for specified database in catalog #2494

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
FangYongs marked this conversation as resolved.
Show resolved Hide resolved
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
Loading