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
Modifier and TypeFieldDescriptionprotected final long
protected final com.github.benmanes.caffeine.cache.Cache<TableIdentifier,
Table> -
Constructor Summary
ModifierConstructorDescriptionprotected
CachingCatalog
(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.boolean
dropTable
(TableIdentifier ident, boolean purge) Drop a table; optionally delete data and metadata files.void
invalidateTable
(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.void
renameTable
(TableIdentifier from, TableIdentifier to) Rename a table.static Catalog
static Catalog
static Catalog
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:Catalog
Return the name for this catalog. -
listTables
Description copied from interface:Catalog
Return all the identifiers under this namespace.- Specified by:
listTables
in interfaceCatalog
- Parameters:
namespace
- a namespace- Returns:
- a list of identifiers for tables
-
loadTable
Description copied from interface:Catalog
Load a table. -
dropTable
Description copied from interface:Catalog
Drop 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:Catalog
Rename a table.- Specified by:
renameTable
in interfaceCatalog
- Parameters:
from
- identifier of the table to renameto
- new table name
-
invalidateTable
Description copied from interface:Catalog
Invalidate 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:
invalidateTable
in interfaceCatalog
- Parameters:
ident
- a table identifier
-
registerTable
Description copied from interface:Catalog
Register a table with the catalog if it does not exist.- Specified by:
registerTable
in 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:
buildTable
in interfaceCatalog
- Parameters:
identifier
- a table identifierschema
- a schema- Returns:
- the builder to create a table or start a create/replace transaction
-