Class LocalIcebergCatalog
java.lang.Object
org.apache.iceberg.BaseMetastoreCatalog
org.apache.iceberg.view.BaseMetastoreViewCatalog
org.apache.polaris.service.catalog.iceberg.LocalIcebergCatalog
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.iceberg.catalog.Catalog,org.apache.iceberg.catalog.SupportsNamespaces,org.apache.iceberg.catalog.ViewCatalog,SupportsNotifications
public class LocalIcebergCatalog
extends org.apache.iceberg.view.BaseMetastoreViewCatalog
implements org.apache.iceberg.catalog.SupportsNamespaces, SupportsNotifications, Closeable
Defines the relationship between PolarisEntities and Iceberg's business logic.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassAn implementation ofTableOperationsthat integrates withLocalIcebergCatalog.Nested classes/interfaces inherited from class org.apache.iceberg.view.BaseMetastoreViewCatalog
org.apache.iceberg.view.BaseMetastoreViewCatalog.BaseMetastoreViewCatalogTableBuilder, org.apache.iceberg.view.BaseMetastoreViewCatalog.BaseViewBuilderNested classes/interfaces inherited from class org.apache.iceberg.BaseMetastoreCatalog
org.apache.iceberg.BaseMetastoreCatalog.BaseMetastoreCatalogTableBuilderNested classes/interfaces inherited from interface org.apache.iceberg.catalog.Catalog
org.apache.iceberg.catalog.Catalog.TableBuilder -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionLocalIcebergCatalog(org.apache.polaris.core.PolarisDiagnostics diagnostics, org.apache.polaris.core.persistence.resolver.ResolverFactory resolverFactory, org.apache.polaris.core.persistence.PolarisMetaStoreManager metaStoreManager, org.apache.polaris.core.context.CallContext callContext, org.apache.polaris.core.persistence.resolver.PolarisResolutionManifestCatalogView resolvedEntityView, org.apache.polaris.core.auth.PolarisPrincipal principal, TaskExecutor taskExecutor, StorageAccessConfigProvider storageAccessConfigProvider, FileIOFactory fileIOFactory, PolarisEventDispatcher polarisEventDispatcher, PolarisEventMetadataFactory eventMetadataFactory) LocalIcebergCatalog(org.apache.polaris.core.PolarisDiagnostics diagnostics, org.apache.polaris.core.persistence.resolver.ResolverFactory resolverFactory, org.apache.polaris.core.persistence.PolarisMetaStoreManager metaStoreManager, org.apache.polaris.core.context.CallContext callContext, org.apache.polaris.core.persistence.resolver.PolarisResolutionManifestCatalogView resolvedEntityView, org.apache.polaris.core.auth.PolarisPrincipal principal, TaskExecutor taskExecutor, StorageAccessConfigProvider storageAccessConfigProvider, FileIOFactory fileIOFactory, PolarisEventDispatcher polarisEventDispatcher, PolarisEventMetadataFactory eventMetadataFactory, IdempotencyRequestContext idempotencyRequestContext) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.iceberg.catalog.Catalog.TableBuilderbuildTable(org.apache.iceberg.catalog.TableIdentifier identifier, org.apache.iceberg.Schema schema) org.apache.iceberg.view.ViewBuilderbuildView(org.apache.iceberg.catalog.TableIdentifier identifier) voidclose()voidcreateNamespace(org.apache.iceberg.catalog.Namespace namespace) voidcreateNamespace(org.apache.iceberg.catalog.Namespace namespace, Map<String, String> metadata) protected StringdefaultWarehouseLocation(org.apache.iceberg.catalog.TableIdentifier tableIdentifier) booleandropNamespace(org.apache.iceberg.catalog.Namespace namespace) booleandropTable(org.apache.iceberg.catalog.TableIdentifier tableIdentifier, boolean purge) booleandropView(org.apache.iceberg.catalog.TableIdentifier identifier) voidinitialize(String name, Map<String, String> properties) List<org.apache.iceberg.catalog.Namespace> List<org.apache.iceberg.catalog.Namespace> listNamespaces(org.apache.iceberg.catalog.Namespace namespace) org.apache.polaris.core.persistence.pagination.Page<org.apache.iceberg.catalog.Namespace> listNamespaces(org.apache.iceberg.catalog.Namespace namespace, org.apache.polaris.core.persistence.pagination.PageToken pageToken) List<org.apache.iceberg.catalog.TableIdentifier> listTables(org.apache.iceberg.catalog.Namespace namespace) org.apache.polaris.core.persistence.pagination.Page<org.apache.iceberg.catalog.TableIdentifier> listTables(org.apache.iceberg.catalog.Namespace namespace, org.apache.polaris.core.persistence.pagination.PageToken pageToken) List<org.apache.iceberg.catalog.TableIdentifier> listViews(org.apache.iceberg.catalog.Namespace namespace) org.apache.polaris.core.persistence.pagination.Page<org.apache.iceberg.catalog.TableIdentifier> listViews(org.apache.iceberg.catalog.Namespace namespace, org.apache.polaris.core.persistence.pagination.PageToken pageToken) loadNamespaceMetadata(org.apache.iceberg.catalog.Namespace namespace) org.apache.iceberg.view.ViewloadView(org.apache.iceberg.catalog.TableIdentifier identifier) Override to fix a bug inBaseMetastoreViewCatalog.loadView(org.apache.iceberg.catalog.TableIdentifier)wherenewViewOps(org.apache.iceberg.catalog.TableIdentifier)is called twice, causing redundant metadata fetches.name()booleannamespaceExists(org.apache.iceberg.catalog.Namespace namespace) protected org.apache.iceberg.TableOperationsnewTableOps(org.apache.iceberg.catalog.TableIdentifier tableIdentifier) org.apache.iceberg.TableOperationsnewTableOps(org.apache.iceberg.catalog.TableIdentifier tableIdentifier, boolean makeMetadataCurrentOnCommit) protected org.apache.iceberg.view.ViewOperationsnewViewOps(org.apache.iceberg.catalog.TableIdentifier identifier) org.apache.iceberg.TableregisterTable(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation) org.apache.iceberg.TableregisterTable(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation, boolean overwrite) Register a table with optional overwrite semantics.org.apache.iceberg.view.ViewregisterView(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation) booleanremoveProperties(org.apache.iceberg.catalog.Namespace namespace, Set<String> properties) voidrenameTable(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier to) voidrenameView(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier to) booleansendNotification(org.apache.iceberg.catalog.TableIdentifier identifier, org.apache.polaris.service.types.NotificationRequest notificationRequest) voidsetCatalogFileIo(org.apache.iceberg.io.FileIO fileIO) voidsetMetaStoreManager(org.apache.polaris.core.persistence.PolarisMetaStoreManager newMetaStoreManager) voidsetMetaStoreManager(org.apache.polaris.core.persistence.PolarisMetaStoreManager newMetaStoreManager, Consumer<org.apache.polaris.service.catalog.iceberg.MetadataFileCleanup> deleteLogic) Sets the meta store manager and optionally a custom logic for deleting removed metadata files.booleansetProperties(org.apache.iceberg.catalog.Namespace namespace, Map<String, String> properties) transformTableLikeLocation(org.apache.iceberg.catalog.TableIdentifier tableIdentifier, String location) Based on configuration settings, for callsites that need to handle potentially setting a new base location for a TableLike entity, produces the transformed location if applicable, or else the unaltered specified location.Methods inherited from class org.apache.iceberg.BaseMetastoreCatalog
fullTableName, isValidIdentifier, isValidMetadataIdentifier, loadTable, metricsReporter, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.iceberg.catalog.Catalog
createTable, createTable, createTable, createTable, dropTable, invalidateTable, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, tableExistsMethods inherited from interface org.apache.iceberg.catalog.ViewCatalog
invalidateView, viewExists
-
Field Details
-
SHOULD_RETRY_REFRESH_PREDICATE
-
-
Constructor Details
-
LocalIcebergCatalog
public LocalIcebergCatalog(org.apache.polaris.core.PolarisDiagnostics diagnostics, org.apache.polaris.core.persistence.resolver.ResolverFactory resolverFactory, org.apache.polaris.core.persistence.PolarisMetaStoreManager metaStoreManager, org.apache.polaris.core.context.CallContext callContext, org.apache.polaris.core.persistence.resolver.PolarisResolutionManifestCatalogView resolvedEntityView, org.apache.polaris.core.auth.PolarisPrincipal principal, TaskExecutor taskExecutor, StorageAccessConfigProvider storageAccessConfigProvider, FileIOFactory fileIOFactory, PolarisEventDispatcher polarisEventDispatcher, PolarisEventMetadataFactory eventMetadataFactory) - Parameters:
callContext- the current CallContextresolvedEntityView- accessor to resolved entity paths that have been pre-vetted to ensure this catalog instance only interacts with authorized resolved paths.taskExecutor- Executor we use to register cleanup task handlers
-
LocalIcebergCatalog
public LocalIcebergCatalog(org.apache.polaris.core.PolarisDiagnostics diagnostics, org.apache.polaris.core.persistence.resolver.ResolverFactory resolverFactory, org.apache.polaris.core.persistence.PolarisMetaStoreManager metaStoreManager, org.apache.polaris.core.context.CallContext callContext, org.apache.polaris.core.persistence.resolver.PolarisResolutionManifestCatalogView resolvedEntityView, org.apache.polaris.core.auth.PolarisPrincipal principal, TaskExecutor taskExecutor, StorageAccessConfigProvider storageAccessConfigProvider, FileIOFactory fileIOFactory, PolarisEventDispatcher polarisEventDispatcher, PolarisEventMetadataFactory eventMetadataFactory, IdempotencyRequestContext idempotencyRequestContext)
-
-
Method Details
-
name
- Specified by:
namein interfaceorg.apache.iceberg.catalog.Catalog- Specified by:
namein interfaceorg.apache.iceberg.catalog.ViewCatalog- Overrides:
namein classorg.apache.iceberg.view.BaseMetastoreViewCatalog
-
setCatalogFileIo
public void setCatalogFileIo(org.apache.iceberg.io.FileIO fileIO) -
initialize
- Specified by:
initializein interfaceorg.apache.iceberg.catalog.Catalog- Specified by:
initializein interfaceorg.apache.iceberg.catalog.ViewCatalog- Overrides:
initializein classorg.apache.iceberg.view.BaseMetastoreViewCatalog
-
setMetaStoreManager
public void setMetaStoreManager(org.apache.polaris.core.persistence.PolarisMetaStoreManager newMetaStoreManager) -
setMetaStoreManager
public void setMetaStoreManager(org.apache.polaris.core.persistence.PolarisMetaStoreManager newMetaStoreManager, Consumer<org.apache.polaris.service.catalog.iceberg.MetadataFileCleanup> deleteLogic) Sets the meta store manager and optionally a custom logic for deleting removed metadata files. This allows the caller (e.g. during commitTransaction) to provide a collector instead of immediate deletion, avoiding premature deletes that could lead to corruption on rollback. -
properties
- Overrides:
propertiesin classorg.apache.iceberg.BaseMetastoreCatalog
-
registerTable
public org.apache.iceberg.Table registerTable(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation) - Specified by:
registerTablein interfaceorg.apache.iceberg.catalog.Catalog- Overrides:
registerTablein classorg.apache.iceberg.BaseMetastoreCatalog
-
registerTable
public org.apache.iceberg.Table registerTable(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation, boolean overwrite) Register a table with optional overwrite semantics.When
overwriteis false (the default) this behaves like a normal register and will fail if the table already exists. Whenoverwriteis true and the named table already exists, this method updates the table's stored metadata-location to point at the provided metadata file. The overwrite path performs additional validation to ensure the supplied metadata file and its location are consistent with the table's resolved storage configuration.- Specified by:
registerTablein interfaceorg.apache.iceberg.catalog.Catalog- Parameters:
identifier- the table identifiermetadataFileLocation- the metadata file locationoverwrite- if true, update existing table metadata; if false, throw exception if table exists- Returns:
- the registered table
-
buildTable
public org.apache.iceberg.catalog.Catalog.TableBuilder buildTable(org.apache.iceberg.catalog.TableIdentifier identifier, org.apache.iceberg.Schema schema) - Specified by:
buildTablein interfaceorg.apache.iceberg.catalog.Catalog- Overrides:
buildTablein classorg.apache.iceberg.view.BaseMetastoreViewCatalog
-
buildView
public org.apache.iceberg.view.ViewBuilder buildView(org.apache.iceberg.catalog.TableIdentifier identifier) - Specified by:
buildViewin interfaceorg.apache.iceberg.catalog.ViewCatalog- Overrides:
buildViewin classorg.apache.iceberg.view.BaseMetastoreViewCatalog
-
newTableOps
public org.apache.iceberg.TableOperations newTableOps(org.apache.iceberg.catalog.TableIdentifier tableIdentifier, boolean makeMetadataCurrentOnCommit) -
newTableOps
protected org.apache.iceberg.TableOperations newTableOps(org.apache.iceberg.catalog.TableIdentifier tableIdentifier) - Specified by:
newTableOpsin classorg.apache.iceberg.BaseMetastoreCatalog
-
defaultWarehouseLocation
protected String defaultWarehouseLocation(org.apache.iceberg.catalog.TableIdentifier tableIdentifier) - Specified by:
defaultWarehouseLocationin classorg.apache.iceberg.BaseMetastoreCatalog
-
dropTable
public boolean dropTable(org.apache.iceberg.catalog.TableIdentifier tableIdentifier, boolean purge) - Specified by:
dropTablein interfaceorg.apache.iceberg.catalog.Catalog
-
listTables
public List<org.apache.iceberg.catalog.TableIdentifier> listTables(org.apache.iceberg.catalog.Namespace namespace) - Specified by:
listTablesin interfaceorg.apache.iceberg.catalog.Catalog
-
listTables
public org.apache.polaris.core.persistence.pagination.Page<org.apache.iceberg.catalog.TableIdentifier> listTables(org.apache.iceberg.catalog.Namespace namespace, org.apache.polaris.core.persistence.pagination.PageToken pageToken) -
renameTable
public void renameTable(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier to) - Specified by:
renameTablein interfaceorg.apache.iceberg.catalog.Catalog
-
createNamespace
public void createNamespace(org.apache.iceberg.catalog.Namespace namespace) - Specified by:
createNamespacein interfaceorg.apache.iceberg.catalog.SupportsNamespaces
-
createNamespace
public void createNamespace(org.apache.iceberg.catalog.Namespace namespace, Map<String, String> metadata) - Specified by:
createNamespacein interfaceorg.apache.iceberg.catalog.SupportsNamespaces
-
namespaceExists
public boolean namespaceExists(org.apache.iceberg.catalog.Namespace namespace) - Specified by:
namespaceExistsin interfaceorg.apache.iceberg.catalog.SupportsNamespaces
-
dropNamespace
public boolean dropNamespace(org.apache.iceberg.catalog.Namespace namespace) throws org.apache.iceberg.exceptions.NamespaceNotEmptyException - Specified by:
dropNamespacein interfaceorg.apache.iceberg.catalog.SupportsNamespaces- Throws:
org.apache.iceberg.exceptions.NamespaceNotEmptyException
-
setProperties
public boolean setProperties(org.apache.iceberg.catalog.Namespace namespace, Map<String, String> properties) throws org.apache.iceberg.exceptions.NoSuchNamespaceException- Specified by:
setPropertiesin interfaceorg.apache.iceberg.catalog.SupportsNamespaces- Throws:
org.apache.iceberg.exceptions.NoSuchNamespaceException
-
removeProperties
public boolean removeProperties(org.apache.iceberg.catalog.Namespace namespace, Set<String> properties) throws org.apache.iceberg.exceptions.NoSuchNamespaceException - Specified by:
removePropertiesin interfaceorg.apache.iceberg.catalog.SupportsNamespaces- Throws:
org.apache.iceberg.exceptions.NoSuchNamespaceException
-
loadNamespaceMetadata
public Map<String,String> loadNamespaceMetadata(org.apache.iceberg.catalog.Namespace namespace) throws org.apache.iceberg.exceptions.NoSuchNamespaceException - Specified by:
loadNamespaceMetadatain interfaceorg.apache.iceberg.catalog.SupportsNamespaces- Throws:
org.apache.iceberg.exceptions.NoSuchNamespaceException
-
listNamespaces
- Specified by:
listNamespacesin interfaceorg.apache.iceberg.catalog.SupportsNamespaces
-
listNamespaces
public List<org.apache.iceberg.catalog.Namespace> listNamespaces(org.apache.iceberg.catalog.Namespace namespace) throws org.apache.iceberg.exceptions.NoSuchNamespaceException - Specified by:
listNamespacesin interfaceorg.apache.iceberg.catalog.SupportsNamespaces- Throws:
org.apache.iceberg.exceptions.NoSuchNamespaceException
-
listNamespaces
public org.apache.polaris.core.persistence.pagination.Page<org.apache.iceberg.catalog.Namespace> listNamespaces(org.apache.iceberg.catalog.Namespace namespace, org.apache.polaris.core.persistence.pagination.PageToken pageToken) throws org.apache.iceberg.exceptions.NoSuchNamespaceException - Throws:
org.apache.iceberg.exceptions.NoSuchNamespaceException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.apache.iceberg.BaseMetastoreCatalog- Throws:
IOException
-
listViews
public List<org.apache.iceberg.catalog.TableIdentifier> listViews(org.apache.iceberg.catalog.Namespace namespace) - Specified by:
listViewsin interfaceorg.apache.iceberg.catalog.ViewCatalog
-
listViews
public org.apache.polaris.core.persistence.pagination.Page<org.apache.iceberg.catalog.TableIdentifier> listViews(org.apache.iceberg.catalog.Namespace namespace, org.apache.polaris.core.persistence.pagination.PageToken pageToken) -
newViewOps
protected org.apache.iceberg.view.ViewOperations newViewOps(org.apache.iceberg.catalog.TableIdentifier identifier) - Specified by:
newViewOpsin classorg.apache.iceberg.view.BaseMetastoreViewCatalog
-
loadView
public org.apache.iceberg.view.View loadView(org.apache.iceberg.catalog.TableIdentifier identifier) Override to fix a bug inBaseMetastoreViewCatalog.loadView(org.apache.iceberg.catalog.TableIdentifier)wherenewViewOps(org.apache.iceberg.catalog.TableIdentifier)is called twice, causing redundant metadata fetches. This implementation reuses the sameViewOperationsinstance.- Specified by:
loadViewin interfaceorg.apache.iceberg.catalog.ViewCatalog- Overrides:
loadViewin classorg.apache.iceberg.view.BaseMetastoreViewCatalog
-
registerView
public org.apache.iceberg.view.View registerView(org.apache.iceberg.catalog.TableIdentifier identifier, String metadataFileLocation) - Specified by:
registerViewin interfaceorg.apache.iceberg.catalog.ViewCatalog- Overrides:
registerViewin classorg.apache.iceberg.view.BaseMetastoreViewCatalog
-
dropView
public boolean dropView(org.apache.iceberg.catalog.TableIdentifier identifier) - Specified by:
dropViewin interfaceorg.apache.iceberg.catalog.ViewCatalog
-
renameView
public void renameView(org.apache.iceberg.catalog.TableIdentifier from, org.apache.iceberg.catalog.TableIdentifier to) - Specified by:
renameViewin interfaceorg.apache.iceberg.catalog.ViewCatalog
-
sendNotification
public boolean sendNotification(org.apache.iceberg.catalog.TableIdentifier identifier, org.apache.polaris.service.types.NotificationRequest notificationRequest) - Specified by:
sendNotificationin interfaceSupportsNotifications
-
transformTableLikeLocation
public String transformTableLikeLocation(org.apache.iceberg.catalog.TableIdentifier tableIdentifier, String location) Based on configuration settings, for callsites that need to handle potentially setting a new base location for a TableLike entity, produces the transformed location if applicable, or else the unaltered specified location.
-