Skip to content
Merged
Show file tree
Hide file tree
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 @@ -205,11 +205,19 @@ public Catalog.TypeEnum getCatalogType() {
.orElse(null);
}

public boolean isExternal() {
return getCatalogType() == Catalog.TypeEnum.EXTERNAL;
}

public boolean isPassthroughFacade() {
return getInternalPropertiesAsMap()
.containsKey(PolarisEntityConstants.getConnectionConfigInfoPropertyName());
}

public boolean isStaticFacade() {
return isExternal() && !isPassthroughFacade();
}

public ConnectionConfigInfoDpo getConnectionConfigInfoDpo() {
String configStr =
getInternalPropertiesAsMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,6 @@ public CreateNamespaceResponse createNamespace(CreateNamespaceRequest request) {
}
}

private static boolean isStaticFacade(CatalogEntity catalog) {
return org.apache.polaris.core.admin.model.Catalog.TypeEnum.EXTERNAL.equals(
catalog.getCatalogType())
&& !catalog.isPassthroughFacade();
}

public GetNamespaceResponse loadNamespaceMetadata(Namespace namespace) {
PolarisAuthorizableOperation op = PolarisAuthorizableOperation.LOAD_NAMESPACE_METADATA;
authorizeBasicNamespaceOperationOrThrow(op, namespace);
Expand Down Expand Up @@ -369,7 +363,7 @@ public LoadTableResponse createTableDirect(Namespace namespace, CreateTableReque
authorizeCreateTableLikeUnderNamespaceOperationOrThrow(op, identifier);

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
}
CreateTableRequest requestWithoutReservedProperties =
Expand Down Expand Up @@ -400,7 +394,7 @@ public LoadTableResponse createTableDirectWithWriteDelegation(
op, TableIdentifier.of(namespace, request.name()));

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
}
request.validate();
Expand Down Expand Up @@ -492,7 +486,7 @@ public LoadTableResponse createTableStaged(Namespace namespace, CreateTableReque
op, TableIdentifier.of(namespace, request.name()));

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
}
TableMetadata metadata = stageTableCreateHelper(namespace, request);
Expand All @@ -507,7 +501,7 @@ public LoadTableResponse createTableStagedWithWriteDelegation(
op, TableIdentifier.of(namespace, request.name()));

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot create table on static-facade external catalogs.");
}
TableIdentifier ident = TableIdentifier.of(namespace, request.name());
Expand Down Expand Up @@ -778,7 +772,7 @@ public LoadTableResponse updateTable(
op, PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier);

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot update table on static-facade external catalogs.");
}
return catalogHandlerUtils.updateTable(
Expand All @@ -791,7 +785,7 @@ public LoadTableResponse updateTableForStagedCreate(
authorizeCreateTableLikeUnderNamespaceOperationOrThrow(op, tableIdentifier);

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot update table on static-facade external catalogs.");
}
return catalogHandlerUtils.updateTable(
Expand All @@ -812,7 +806,7 @@ public void dropTableWithPurge(TableIdentifier tableIdentifier) {
op, PolarisEntitySubType.ICEBERG_TABLE, tableIdentifier);

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot drop table on static-facade external catalogs.");
}
catalogHandlerUtils.purgeTable(baseCatalog, tableIdentifier);
Expand All @@ -833,7 +827,7 @@ public void renameTable(RenameTableRequest request) {
op, PolarisEntitySubType.ICEBERG_TABLE, request.source(), request.destination());

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot rename table on static-facade external catalogs.");
}
catalogHandlerUtils.renameTable(baseCatalog, request);
Expand All @@ -852,7 +846,7 @@ public void commitTransaction(CommitTransactionRequest commitTransactionRequest)
.map(UpdateTableRequest::identifier)
.toList());
CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot update table on static-facade external catalogs.");
}

Expand Down Expand Up @@ -969,7 +963,7 @@ public LoadViewResponse createView(Namespace namespace, CreateViewRequest reques
op, TableIdentifier.of(namespace, request.name()));

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot create view on static-facade external catalogs.");
}
return catalogHandlerUtils.createView(viewCatalog, namespace, request);
Expand All @@ -987,7 +981,7 @@ public LoadViewResponse replaceView(TableIdentifier viewIdentifier, UpdateTableR
authorizeBasicTableLikeOperationOrThrow(op, PolarisEntitySubType.ICEBERG_VIEW, viewIdentifier);

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot replace view on static-facade external catalogs.");
}
return catalogHandlerUtils.updateView(viewCatalog, viewIdentifier, applyUpdateFilters(request));
Expand All @@ -1014,7 +1008,7 @@ public void renameView(RenameTableRequest request) {
op, PolarisEntitySubType.ICEBERG_VIEW, request.source(), request.destination());

CatalogEntity catalog = getResolvedCatalogEntity();
if (isStaticFacade(catalog)) {
if (catalog.isStaticFacade()) {
throw new BadRequestException("Cannot rename view on static-facade external catalogs.");
}
catalogHandlerUtils.renameView(viewCatalog, request);
Expand Down