Skip to content

Commit

Permalink
[apache#4332]Improve(trino-connector): Make the CatalogConnectorConte…
Browse files Browse the repository at this point in the history
…xt.Builder's functions to public (apache#4333)

### What changes were proposed in this pull request?

Make the CatalogConnectorContext.Builder's functions to public. Users
can extend the CatalogConnectorFactory outside the package.

### Why are the changes needed?

Fix: apache#4332 

### Does this PR introduce _any_ user-facing change?

NO

### How was this patch tested?

NO
  • Loading branch information
diqiu50 authored Aug 1, 2024
1 parent 25b138c commit 9a3dfa1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public Connector create(

gravitinoSystemTableFactory = new GravitinoSystemTableFactory(catalogConnectorManager);
} catch (Exception e) {
String message = "Initialization of the GravitinoConnector failed" + e.getMessage();
String message = "Initialization of the GravitinoConnector failed " + e.getMessage();
LOG.error(message);
throw new TrinoException(GRAVITINO_RUNTIME_ERROR, message, e);
}
Expand Down Expand Up @@ -141,7 +141,7 @@ private CatalogConnectorFactory createCatalogConnectorFactory(GravitinoConfig co
return (CatalogConnectorFactory) obj;
} catch (Exception e) {
throw new TrinoException(
GRAVITINO_RUNTIME_ERROR, "Can not create CatalogConnectorFactory", e);
GRAVITINO_RUNTIME_ERROR, "Can not create CatalogConnectorFactory ", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public CatalogConnectorMetadataAdapter getMetadataAdapter() {
return adapter.getMetadataAdapter();
}

static class Builder {
public static class Builder {
private final CatalogConnectorAdapter connectorAdapter;
private GravitinoCatalog catalog;
private GravitinoMetalake metalake;
private ConnectorContext context;

Builder(CatalogConnectorAdapter connectorAdapter) {
public Builder(CatalogConnectorAdapter connectorAdapter) {
this.connectorAdapter = connectorAdapter;
}

Expand All @@ -115,17 +115,17 @@ public Builder clone(GravitinoCatalog catalog) {
return new Builder(connectorAdapter, catalog);
}

Builder withMetalake(GravitinoMetalake metalake) {
public Builder withMetalake(GravitinoMetalake metalake) {
this.metalake = metalake;
return this;
}

Builder withContext(ConnectorContext context) {
public Builder withContext(ConnectorContext context) {
this.context = context;
return this;
}

CatalogConnectorContext build() throws Exception {
public CatalogConnectorContext build() throws Exception {
Preconditions.checkArgument(metalake != null, "metalake is not null");
Preconditions.checkArgument(catalog != null, "catalog is not null");
Preconditions.checkArgument(context != null, "context is not null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public DefaultCatalogConnectorFactory(GravitinoConfig config) {
"jdbc-mysql", new CatalogConnectorContext.Builder(new MySQLConnectorAdapter()));
catalogBuilders.put(
"jdbc-postgresql", new CatalogConnectorContext.Builder(new PostgreSQLConnectorAdapter()));
LOG.info("Start the DefaultCatalogConnectorFactory");
}

public CatalogConnectorContext.Builder createCatalogConnectorContextBuilder(
Expand Down

0 comments on commit 9a3dfa1

Please sign in to comment.