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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ This product includes code from Apache Iceberg.
* spec/iceberg-rest-catalog-open-api.yaml
* spec/polaris-catalog-apis/oauth-tokens-api.yaml
* integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationBase.java
* runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java
* runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/LocalIcebergCatalog.java
* runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java
* plugins/spark/common/src/main/java/org/apache/polaris/spark/PolarisRESTCatalog.java
* plugins/spark/v3.5/spark/src/main/java/org/apache/polaris/spark/SparkCatalog.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public ListNamespacesResponse listNamespaces(
return catalogHandlerUtils().listNamespaces(namespaceCatalog, parent, pageToken, pageSize);
} else {
PageToken pageRequest = PageToken.build(pageToken, pageSize, this::shouldDecodeToken);
var results = ((IcebergCatalog) baseCatalog).listNamespaces(parent, pageRequest);
var results = ((LocalIcebergCatalog) baseCatalog).listNamespaces(parent, pageRequest);
return ListNamespacesResponse.builder()
.addAll(results.items())
.nextPageToken(results.encodedResponseToken())
Expand Down Expand Up @@ -400,7 +400,7 @@ public ListTablesResponse listTables(Namespace namespace, String pageToken, Inte
return catalogHandlerUtils().listTables(baseCatalog, namespace, pageToken, pageSize);
} else {
PageToken pageRequest = PageToken.build(pageToken, pageSize, this::shouldDecodeToken);
var results = ((IcebergCatalog) baseCatalog).listTables(namespace, pageRequest);
var results = ((LocalIcebergCatalog) baseCatalog).listTables(namespace, pageRequest);
return ListTablesResponse.builder()
.addAll(results.items())
.nextPageToken(results.encodedResponseToken())
Expand Down Expand Up @@ -527,7 +527,8 @@ private TableMetadata stageTableCreateHelper(Namespace namespace, CreateTableReq
location = request.location();
} else {
location =
((IcebergCatalog) baseCatalog).transformTableLikeLocation(ident, request.location());
((LocalIcebergCatalog) baseCatalog)
.transformTableLikeLocation(ident, request.location());
}
} else {
location =
Expand Down Expand Up @@ -593,7 +594,7 @@ public LoadTableResponse createTableStaged(
TableIdentifier ident = TableIdentifier.of(namespace, request.name());
TableMetadata metadata = stageTableCreateHelper(namespace, request);

if (baseCatalog instanceof IcebergCatalog polarisCatalog) {
if (baseCatalog instanceof LocalIcebergCatalog polarisCatalog) {
polarisCatalog.validateStagedTableCreate(ident, metadata);
}

Expand Down Expand Up @@ -803,7 +804,7 @@ public ImmutableLoadCredentialsResponse loadCredentials(
// the remote catalog's actual table metadata.
// Note: this check must come after authorizeLoadTable because baseCatalog is
// initialized lazily during authorization.
if (!(baseCatalog instanceof IcebergCatalog)) {
if (!(baseCatalog instanceof LocalIcebergCatalog)) {
return fallbackToFullLoadTable(tableIdentifier, refreshCredentialsEndpoint);
}

Expand Down Expand Up @@ -1096,7 +1097,7 @@ private UpdateTableRequest applyUpdateFilters(UpdateTableRequest request) {
if (!isFederated && update instanceof MetadataUpdate.SetLocation setLocation) {
String requestedLocation = setLocation.location();
String filteredLocation =
((IcebergCatalog) baseCatalog)
((LocalIcebergCatalog) baseCatalog)
.transformTableLikeLocation(identifier, requestedLocation);
return new MetadataUpdate.SetLocation(filteredLocation);
} else {
Expand Down Expand Up @@ -1210,7 +1211,7 @@ public void commitTransaction(CommitTransactionRequest commitTransactionRequest)
// validations.
TransactionWorkspaceMetaStoreManager transactionMetaStoreManager =
new TransactionWorkspaceMetaStoreManager(diagnostics(), metaStoreManager());
((IcebergCatalog) baseCatalog).setMetaStoreManager(transactionMetaStoreManager);
((LocalIcebergCatalog) baseCatalog).setMetaStoreManager(transactionMetaStoreManager);

// Group all changes by table identifier to handle them atomically.
// This prevents conflicts when multiple changes target the same table entity.
Expand Down Expand Up @@ -1318,7 +1319,7 @@ public ListTablesResponse listViews(Namespace namespace, String pageToken, Integ
baseCatalog.getClass().getName());
} else {
PageToken pageRequest = PageToken.build(pageToken, pageSize, this::shouldDecodeToken);
var results = ((IcebergCatalog) baseCatalog).listViews(namespace, pageRequest);
var results = ((LocalIcebergCatalog) baseCatalog).listViews(namespace, pageRequest);
return ListTablesResponse.builder()
.addAll(results.items())
.nextPageToken(results.encodedResponseToken())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@
import org.slf4j.LoggerFactory;

/** Defines the relationship between PolarisEntities and Iceberg's business logic. */
public class IcebergCatalog extends BaseMetastoreViewCatalog
public class LocalIcebergCatalog extends BaseMetastoreViewCatalog
implements SupportsNamespaces, SupportsNotifications, Closeable {
private static final Logger LOGGER = LoggerFactory.getLogger(IcebergCatalog.class);
private static final Logger LOGGER = LoggerFactory.getLogger(LocalIcebergCatalog.class);

private static final Joiner SLASH = Joiner.on("/");

Expand Down Expand Up @@ -202,7 +202,7 @@ public class IcebergCatalog extends BaseMetastoreViewCatalog
* this catalog instance only interacts with authorized resolved paths.
* @param taskExecutor Executor we use to register cleanup task handlers
*/
public IcebergCatalog(
public LocalIcebergCatalog(
PolarisDiagnostics diagnostics,
ResolverFactory resolverFactory,
PolarisMetaStoreManager metaStoreManager,
Expand Down Expand Up @@ -688,7 +688,7 @@ private String resolveNamespaceLocation(Namespace namespace, Map<String, String>
.reversed()
.stream()
.map(entity -> baseLocation(diagnostics, entity))
.map(IcebergCatalog::stripLeadingTrailingSlash)
.map(LocalIcebergCatalog::stripLeadingTrailingSlash)
.collect(Collectors.joining("/"));
}

Expand Down Expand Up @@ -1509,7 +1509,8 @@ private class PolarisIcebergCatalogViewBuilder extends BaseMetastoreViewCatalog.
public PolarisIcebergCatalogViewBuilder(TableIdentifier identifier) {
super(identifier);
withProperties(
PropertyUtil.propertiesWithPrefix(IcebergCatalog.this.properties(), "table-default."));
PropertyUtil.propertiesWithPrefix(
LocalIcebergCatalog.this.properties(), "table-default."));
this.identifier = identifier;
}

Expand All @@ -1520,8 +1521,8 @@ public ViewBuilder withLocation(String newLocation) {
}

/**
* An implementation of {@link TableOperations} that integrates with {@link IcebergCatalog}. Much
* of this code was originally copied from {@link
* An implementation of {@link TableOperations} that integrates with {@link LocalIcebergCatalog}.
* Much of this code was originally copied from {@link
* org.apache.iceberg.BaseMetastoreTableOperations}. CODE_COPIED_TO_POLARIS From Apache Iceberg
* Version: 1.8
*/
Expand Down Expand Up @@ -1984,9 +1985,10 @@ private static Map<String, String> buildTableMetadataPropertiesMap(TableMetadata
}

/**
* An implementation of {@link ViewOperations} that integrates with {@link IcebergCatalog}. Much
* of this code was originally copied from {@link org.apache.iceberg.view.BaseViewOperations}.
* CODE_COPIED_TO_POLARIS From Apache Iceberg Version: 1.8
* An implementation of {@link ViewOperations} that integrates with {@link LocalIcebergCatalog}.
* Much of this code was originally copied from {@link
* org.apache.iceberg.view.BaseViewOperations}. CODE_COPIED_TO_POLARIS From Apache Iceberg
* Version: 1.8
*/
private class BasePolarisViewOperations extends PolarisOperationsBase<ViewMetadata>
implements ViewOperations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.apache.polaris.core.persistence.PolarisMetaStoreManager;
import org.apache.polaris.core.persistence.resolver.PolarisResolutionManifest;
import org.apache.polaris.core.persistence.resolver.ResolverFactory;
import org.apache.polaris.service.catalog.iceberg.IcebergCatalog;
import org.apache.polaris.service.catalog.iceberg.LocalIcebergCatalog;
import org.apache.polaris.service.catalog.io.FileIOFactory;
import org.apache.polaris.service.catalog.io.StorageAccessConfigProvider;
import org.apache.polaris.service.events.PolarisEventDispatcher;
Expand Down Expand Up @@ -89,8 +89,8 @@ public Catalog createCatalog(final PolarisResolutionManifest resolvedManifest) {
String catalogKey = realm + "/" + catalogName;
LOGGER.debug("Initializing new BasePolarisCatalog for key: {}", catalogKey);

IcebergCatalog catalogInstance =
new IcebergCatalog(
LocalIcebergCatalog catalogInstance =
new LocalIcebergCatalog(
diagnostics,
resolverFactory,
metaStoreManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView;
import org.apache.polaris.service.catalog.Profiles;
import org.apache.polaris.service.catalog.generic.PolarisGenericTableCatalog;
import org.apache.polaris.service.catalog.iceberg.IcebergCatalog;
import org.apache.polaris.service.catalog.iceberg.LocalIcebergCatalog;
import org.apache.polaris.service.catalog.io.FileIOFactory;
import org.apache.polaris.service.catalog.io.StorageAccessConfigProvider;
import org.apache.polaris.service.catalog.policy.PolicyCatalog;
Expand Down Expand Up @@ -197,7 +197,7 @@ public Map<String, String> getConfigOverrides() {
@Inject protected RealmContextHolder realmContextHolder;
@Inject protected PolarisEventDispatcher polarisEventDispatcher;

protected IcebergCatalog baseCatalog;
protected LocalIcebergCatalog baseCatalog;
protected PolarisGenericTableCatalog genericTableCatalog;
protected PolicyCatalog policyCatalog;
protected PolarisAdminService adminService;
Expand Down Expand Up @@ -479,7 +479,7 @@ private void initBaseCatalog() {
new PolarisPassthroughResolutionView(
resolutionManifestFactory, authenticatedRoot, CATALOG_NAME);
this.baseCatalog =
new IcebergCatalog(
new LocalIcebergCatalog(
diagServices,
resolverFactory,
metaStoreManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import org.apache.polaris.core.storage.cache.StorageCredentialCache;
import org.apache.polaris.service.admin.PolarisAdminService;
import org.apache.polaris.service.catalog.PolarisPassthroughResolutionView;
import org.apache.polaris.service.catalog.iceberg.IcebergCatalog;
import org.apache.polaris.service.catalog.iceberg.LocalIcebergCatalog;
import org.apache.polaris.service.catalog.io.FileIOFactory;
import org.apache.polaris.service.catalog.io.StorageAccessConfigProvider;
import org.apache.polaris.service.config.ReservedProperties;
Expand Down Expand Up @@ -111,7 +111,7 @@ public abstract class AbstractPolarisGenericTableCatalogTest {
@Inject PolarisPrincipalHolder polarisPrincipalHolder;

private PolarisGenericTableCatalog genericTableCatalog;
private IcebergCatalog icebergCatalog;
private LocalIcebergCatalog icebergCatalog;
private AwsStorageConfigInfo storageConfigModel;
private String realmName;
private PolarisCallContext polarisContext;
Expand Down Expand Up @@ -227,7 +227,7 @@ public void before(TestInfo testInfo) {
new PolarisGenericTableCatalog(metaStoreManager, polarisContext, passthroughView);
this.genericTableCatalog.initialize(CATALOG_NAME, Map.of());
this.icebergCatalog =
new IcebergCatalog(
new LocalIcebergCatalog(
diagServices,
resolverFactory,
metaStoreManager,
Expand Down
Loading