Package org.apache.iceberg
Class CachingCatalog
java.lang.Object
org.apache.iceberg.CachingCatalog
- All Implemented Interfaces:
Catalog
Class that wraps an Iceberg Catalog to cache tables.
See CatalogProperties.CACHE_EXPIRATION_INTERVAL_MS for more details regarding special
values for expirationIntervalMillis.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.iceberg.catalog.Catalog
Catalog.TableBuilder -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longprotected final com.github.benmanes.caffeine.cache.Cache<TableIdentifier,Table> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCachingCatalog(Catalog catalog, boolean caseSensitive, long expirationIntervalMillis, com.github.benmanes.caffeine.cache.Ticker ticker) -
Method Summary
Modifier and TypeMethodDescriptionbuildTable(TableIdentifier identifier, Schema schema) /** Instantiate a builder to either create a table or start a create/replace transaction.booleandropTable(TableIdentifier ident, boolean purge) Drop a table; optionally delete data and metadata files.voidinvalidateTable(TableIdentifier ident) Invalidate cached table metadata from current catalog.listTables(Namespace namespace) Return all the identifiers under this namespace.loadTable(TableIdentifier ident) Load a table.name()Return the name for this catalog.registerTable(TableIdentifier identifier, String metadataFileLocation) Register a table with the catalog if it does not exist.voidrenameTable(TableIdentifier from, TableIdentifier to) Rename a table.static Catalogstatic Catalogstatic CatalogMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.catalog.Catalog
createTable, createTable, createTable, createTable, dropTable, initialize, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, tableExists
-
Field Details
-
expirationIntervalMillis
protected final long expirationIntervalMillis -
tableCache
-
-
Constructor Details
-
CachingCatalog
protected CachingCatalog(Catalog catalog, boolean caseSensitive, long expirationIntervalMillis, com.github.benmanes.caffeine.cache.Ticker ticker)
-
-
Method Details
-
wrap
-
wrap
-
wrap
-
name
Description copied from interface:CatalogReturn the name for this catalog. -
listTables
Description copied from interface:CatalogReturn all the identifiers under this namespace.- Specified by:
listTablesin interfaceCatalog- Parameters:
namespace- a namespace- Returns:
- a list of identifiers for tables
-
loadTable
Description copied from interface:CatalogLoad a table. -
dropTable
Description copied from interface:CatalogDrop a table; optionally delete data and metadata files.If purge is set to true the implementation should delete all data and metadata files.
-
renameTable
Description copied from interface:CatalogRename a table.- Specified by:
renameTablein interfaceCatalog- Parameters:
from- identifier of the table to renameto- new table name
-
invalidateTable
Description copied from interface:CatalogInvalidate cached table metadata from current catalog.If the table is already loaded or cached, drop cached data. If the table does not exist or is not cached, do nothing.
- Specified by:
invalidateTablein interfaceCatalog- Parameters:
ident- a table identifier
-
registerTable
Description copied from interface:CatalogRegister a table with the catalog if it does not exist.- Specified by:
registerTablein interfaceCatalog- Parameters:
identifier- a table identifiermetadataFileLocation- the location of a metadata file- Returns:
- a Table instance
-
buildTable
Description copied from interface:Catalog/** Instantiate a builder to either create a table or start a create/replace transaction.- Specified by:
buildTablein interfaceCatalog- Parameters:
identifier- a table identifierschema- a schema- Returns:
- the builder to create a table or start a create/replace transaction
-