You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2024/11/06 09:57:40 UTC
[PR] [core] Delete useless methods in Catalog [paimon]
JingsongLi opened a new pull request, #4468:
URL: https://github.com/apache/paimon/pull/4468
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
<!-- Linking this pull request to the issue -->
Delete follow methods in Catalog because of useless, We recommend using methods such as `getTable` directly to avoid errors in implementation.
```
/**
* Get lock factory from catalog. Lock is used to support multiple concurrent writes on the
* object store.
*/
Optional<CatalogLockFactory> lockFactory();
/** Get lock context for lock factory to create a lock. */
default Optional<CatalogLockContext> lockContext() {
return Optional.empty();
}
/** Get metastore client factory for the table specified by {@code identifier}. */
default Optional<MetastoreClient.Factory> metastoreClientFactory(Identifier identifier)
throws TableNotExistException {
return Optional.empty();
}
```
Delete follow methods in Catalog because of repetitive:
```
/**
* Check if a database exists in this catalog.
*
* @param databaseName Name of the database
* @return true if the given database exists in the catalog false otherwise
*/
default boolean databaseExists(String databaseName) {
try {
loadDatabaseProperties(databaseName);
return true;
} catch (DatabaseNotExistException e) {
return false;
}
}
/**
* Check if a table exists in this catalog.
*
* @param identifier Path of the table
* @return true if the given table exists in the catalog false otherwise
*/
default boolean tableExists(Identifier identifier) {
try {
return getTable(identifier) != null;
} catch (TableNotExistException e) {
return false;
}
}
/**
* Check if a view exists in this catalog.
*
* @param identifier Path of the view
* @return true if the given view exists in the catalog false otherwise
*/
default boolean viewExists(Identifier identifier) {
try {
return getView(identifier) != null;
} catch (ViewNotExistException e) {
return false;
}
}
```
Modify `loadDatabaseProperties` in Catalog because we can have a better naming for `getDatabase`:
```
/**
* Return a {@link Database} identified by the given name.
*
* @param name Database name
* @return The requested {@link Database}
* @throws DatabaseNotExistException if the requested database does not exist
*/
Database getDatabase(String name) throws DatabaseNotExistException;
```
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
Existing tests.
### API and Format
<!-- Does this change affect API or storage format -->
Catalog API.
### Documentation
<!-- Does this change introduce a new feature -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [core] Delete useless methods in Catalog [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #4468:
URL: https://github.com/apache/paimon/pull/4468
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org