Skip to content

Commit

Permalink
[core] Refactor AbstractCatalog to make metastoreClientFactory public (
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzelin authored Nov 7, 2024
1 parent 4cdaf66 commit 048882a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,27 +399,19 @@ public Table getTable(Identifier identifier) throws TableNotExistException {

protected Table getDataOrFormatTable(Identifier identifier) throws TableNotExistException {
Preconditions.checkArgument(identifier.getSystemTableName() == null);
TableSchema tableSchema = getDataTableSchema(identifier);
return FileStoreTableFactory.create(
fileIO,
getTableLocation(identifier),
getDataTableSchema(identifier),
tableSchema,
new CatalogEnvironment(
identifier,
Lock.factory(
lockFactory().orElse(null), lockContext().orElse(null), identifier),
metastoreClientFactory(identifier).orElse(null),
metastoreClientFactory(identifier, tableSchema).orElse(null),
lineageMetaFactory));
}

protected CatalogEnvironment catalogEnvironment(Identifier identifier)
throws TableNotExistException {
return new CatalogEnvironment(
identifier,
Lock.factory(lockFactory().orElse(null), lockContext().orElse(null), identifier),
metastoreClientFactory(identifier).orElse(null),
lineageMetaFactory);
}

/**
* Create a {@link FormatTable} identified by the given {@link Identifier}.
*
Expand Down Expand Up @@ -462,8 +454,8 @@ protected abstract TableSchema getDataTableSchema(Identifier identifier)
throws TableNotExistException;

/** Get metastore client factory for the table specified by {@code identifier}. */
protected Optional<MetastoreClient.Factory> metastoreClientFactory(Identifier identifier)
throws TableNotExistException {
public Optional<MetastoreClient.Factory> metastoreClientFactory(
Identifier identifier, TableSchema schema) {
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,7 @@ public Optional<CatalogLockContext> lockContext() {
}

@Override
public Optional<MetastoreClient.Factory> metastoreClientFactory(Identifier identifier)
throws TableNotExistException {
return metastoreClientFactory(identifier, getDataTableSchema(identifier));
}

private Optional<MetastoreClient.Factory> metastoreClientFactory(
public Optional<MetastoreClient.Factory> metastoreClientFactory(
Identifier identifier, TableSchema schema) {
Identifier tableIdentifier =
new Identifier(identifier.getDatabaseName(), identifier.getTableName());
Expand Down

0 comments on commit 048882a

Please sign in to comment.