public class CachingCatalog extends DelegateCatalog
Catalog to cache databases and tables and manifests.| Modifier and Type | Class and Description |
|---|---|
static class |
CachingCatalog.CacheSizes
Cache sizes of a caching catalog.
|
Catalog.BranchAlreadyExistException, Catalog.BranchNotExistException, Catalog.ColumnAlreadyExistException, Catalog.ColumnNotExistException, Catalog.DatabaseAlreadyExistException, Catalog.DatabaseNoPermissionException, Catalog.DatabaseNotEmptyException, Catalog.DatabaseNotExistException, Catalog.DialectAlreadyExistException, Catalog.DialectNotExistException, Catalog.ProcessSystemDatabaseException, Catalog.TableAlreadyExistException, Catalog.TableNoPermissionException, Catalog.TableNotExistException, Catalog.TagNotExistException, Catalog.ViewAlreadyExistException, Catalog.ViewNotExistException| Modifier and Type | Field and Description |
|---|---|
protected org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache<String,Database> |
databaseCache |
protected SegmentsCache<Path> |
manifestCache |
protected org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache<Identifier,List<Partition>> |
partitionCache |
protected org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache<Identifier,Table> |
tableCache |
wrappedCOMMENT_PROP, DB_LOCATION_PROP, DB_SUFFIX, DEFAULT_DATABASE, LAST_UPDATE_TIME_PROP, NUM_FILES_PROP, NUM_ROWS_PROP, OWNER_PROP, SYSTEM_BRANCH_PREFIX, SYSTEM_DATABASE_NAME, SYSTEM_TABLE_SPLITTER, TABLE_DEFAULT_OPTION_PREFIX, TOTAL_SIZE_PROP| Constructor and Description |
|---|
CachingCatalog(Catalog wrapped,
Options options) |
| Modifier and Type | Method and Description |
|---|---|
void |
alterDatabase(String name,
List<PropertyChange> changes,
boolean ignoreIfNotExists)
Alter a database.
|
void |
alterPartitions(Identifier identifier,
List<PartitionStatistics> partitions)
Alter partitions of the specify table.
|
void |
alterTable(Identifier identifier,
List<SchemaChange> changes,
boolean ignoreIfNotExists)
Modify an existing table from
SchemaChanges. |
CatalogLoader |
catalogLoader()
Serializable loader to create catalog.
|
void |
dropDatabase(String name,
boolean ignoreIfNotExists,
boolean cascade)
Drop a database.
|
void |
dropPartitions(Identifier identifier,
List<Map<String,String>> partitions)
Drop partitions of the specify table.
|
void |
dropTable(Identifier identifier,
boolean ignoreIfNotExists)
Drop a table.
|
CachingCatalog.CacheSizes |
estimatedCacheSizes()
Cache sizes for compute engine.
|
Database |
getDatabase(String databaseName)
Return a
Database identified by the given name. |
Table |
getTable(Identifier identifier)
Return a
Table identified by the given Identifier. |
void |
invalidateTable(Identifier identifier)
Invalidate cached table metadata for an
identifier. |
List<Partition> |
listPartitions(Identifier identifier)
Get Partition of all partitions of the table.
|
void |
refreshPartitions(Identifier identifier)
Partition cache will affect the latency of table, so refresh method is provided for compute
engine.
|
void |
renameTable(Identifier fromTable,
Identifier toTable,
boolean ignoreIfNotExists)
Rename a table.
|
static Catalog |
tryToCreate(Catalog catalog,
Options options) |
alterView, caseSensitive, close, commitSnapshot, createBranch, createDatabase, createPartitions, createTable, createView, dropBranch, dropView, fastForward, getView, listBranches, listDatabases, listDatabasesPaged, listPartitionsPaged, listTableDetailsPaged, listTables, listTablesPaged, listViewDetailsPaged, listViews, listViewsPaged, loadSnapshot, markDonePartitions, options, renameView, repairCatalog, repairDatabase, repairTable, rollbackTo, rootCatalog, supportsListObjectsPaged, supportsVersionManagement, wrappedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitalterTable, createDatabaseprotected org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache<String,Database> databaseCache
protected org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache<Identifier,Table> tableCache
@Nullable protected final SegmentsCache<Path> manifestCache
@Nullable protected org.apache.paimon.shade.caffeine2.com.github.benmanes.caffeine.cache.Cache<Identifier,List<Partition>> partitionCache
public CatalogLoader catalogLoader()
Catalogpublic Database getDatabase(String databaseName) throws Catalog.DatabaseNotExistException
CatalogDatabase identified by the given name.getDatabase in interface CataloggetDatabase in class DelegateCatalogdatabaseName - Database nameDatabaseCatalog.DatabaseNotExistException - if the requested database does not existpublic void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade) throws Catalog.DatabaseNotExistException, Catalog.DatabaseNotEmptyException
CatalogdropDatabase in interface CatalogdropDatabase in class DelegateCatalogname - Name of the database to be dropped.ignoreIfNotExists - Flag to specify behavior when the database does not exist: if set to
false, throw an exception, if set to true, do nothing.cascade - Flag to specify behavior when the database contains table or function: if set
to true, delete all tables and functions in the database and then delete the database, if
set to false, throw an exception.Catalog.DatabaseNotEmptyException - if the given database is not empty and isRestrict is trueCatalog.DatabaseNotExistExceptionpublic void alterDatabase(String name, List<PropertyChange> changes, boolean ignoreIfNotExists) throws Catalog.DatabaseNotExistException
CatalogalterDatabase in interface CatalogalterDatabase in class DelegateCatalogname - Name of the database to alter.changes - the property changesignoreIfNotExists - Flag to specify behavior when the database does not exist: if set to
false, throw an exception, if set to true, do nothing.Catalog.DatabaseNotExistException - if the given database is not exist and ignoreIfNotExists is
falsepublic void dropTable(Identifier identifier, boolean ignoreIfNotExists) throws Catalog.TableNotExistException
CatalogNOTE: System tables can not be dropped.
dropTable in interface CatalogdropTable in class DelegateCatalogidentifier - Path of the table to be droppedignoreIfNotExists - Flag to specify behavior when the table does not exist: if set to
false, throw an exception, if set to true, do nothing.Catalog.TableNotExistException - if the table does not existpublic void renameTable(Identifier fromTable, Identifier toTable, boolean ignoreIfNotExists) throws Catalog.TableNotExistException, Catalog.TableAlreadyExistException
CatalogNOTE: If you use object storage, such as S3 or OSS, please use this syntax carefully, because the renaming of object storage is not atomic, and only partial files may be moved in case of failure.
NOTE: System tables can not be renamed.
renameTable in interface CatalogrenameTable in class DelegateCatalogfromTable - the name of the table which need to renametoTable - the new tableignoreIfNotExists - Flag to specify behavior when the table does not exist: if set to
false, throw an exception, if set to true, do nothing.Catalog.TableNotExistException - if the fromTable does not existCatalog.TableAlreadyExistException - if the toTable already existspublic void alterTable(Identifier identifier, List<SchemaChange> changes, boolean ignoreIfNotExists) throws Catalog.TableNotExistException, Catalog.ColumnAlreadyExistException, Catalog.ColumnNotExistException
CatalogSchemaChanges.
NOTE: System tables can not be altered.
alterTable in interface CatalogalterTable in class DelegateCatalogidentifier - path of the table to be modifiedchanges - the schema changesignoreIfNotExists - flag to specify behavior when the table does not exist: if set to
false, throw an exception, if set to true, do nothing.Catalog.TableNotExistException - if the table does not existCatalog.ColumnAlreadyExistExceptionCatalog.ColumnNotExistExceptionpublic Table getTable(Identifier identifier) throws Catalog.TableNotExistException
CataloggetTable in interface CataloggetTable in class DelegateCatalogidentifier - Path of the tableCatalog.TableNotExistException - if the target does not existpublic List<Partition> listPartitions(Identifier identifier) throws Catalog.TableNotExistException
CataloglistPartitions in interface CataloglistPartitions in class DelegateCatalogidentifier - path of the table to list partitionsCatalog.TableNotExistException - if the table does not existpublic void dropPartitions(Identifier identifier, List<Map<String,String>> partitions) throws Catalog.TableNotExistException
CatalogdropPartitions in interface CatalogdropPartitions in class DelegateCatalogidentifier - path of the table to drop partitionspartitions - partitions to be deletedCatalog.TableNotExistException - if the table does not existpublic void alterPartitions(Identifier identifier, List<PartitionStatistics> partitions) throws Catalog.TableNotExistException
CatalogalterPartitions in interface CatalogalterPartitions in class DelegateCatalogidentifier - path of the table to alter partitionspartitions - partitions to be alteredCatalog.TableNotExistException - if the table does not existpublic void invalidateTable(Identifier identifier)
Catalogidentifier.
If the table is already loaded or cached, drop cached data. If the table does not exist or is not cached, do nothing. Calling this method should not query remote services.
identifier - a table identifierpublic void refreshPartitions(Identifier identifier) throws Catalog.TableNotExistException
Catalog.TableNotExistExceptionpublic CachingCatalog.CacheSizes estimatedCacheSizes()
Copyright © 2023–2025 The Apache Software Foundation. All rights reserved.