Package org.apache.iceberg.catalog
Interface Catalog
- 
- All Known Implementing Classes:
- BaseMetastoreCatalog,- CachingCatalog,- DynamoDbCatalog,- GlueCatalog,- HadoopCatalog,- HiveCatalog,- JdbcCatalog,- NessieCatalog
 
 public interface CatalogA Catalog API for table create, drop, and load operations.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceCatalog.TableBuilderA builder used to create validtablesor start create/replacetransactions.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Catalog.TableBuilderbuildTable(TableIdentifier identifier, Schema schema)/** Instantiate a builder to either create a table or start a create/replace transaction.default TablecreateTable(TableIdentifier identifier, Schema schema)Create an unpartitioned table.default TablecreateTable(TableIdentifier identifier, Schema schema, PartitionSpec spec)Create a table.default TablecreateTable(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> properties)Create a table.default TablecreateTable(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties)Create a table.default booleandropTable(TableIdentifier identifier)Drop a table and delete all data and metadata files.booleandropTable(TableIdentifier identifier, boolean purge)Drop a table; optionally delete data and metadata files.default voidinitialize(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties)Initialize a catalog given a custom name and a map of catalog properties.default voidinvalidateTable(TableIdentifier identifier)Invalidate cached table metadata from current catalog.java.util.List<TableIdentifier>listTables(Namespace namespace)Return all the identifiers under this namespace.TableloadTable(TableIdentifier identifier)Load a table.default java.lang.Stringname()Return the name for this catalog.default TransactionnewCreateTableTransaction(TableIdentifier identifier, Schema schema)Start a transaction to create a table.default TransactionnewCreateTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec)Start a transaction to create a table.default TransactionnewCreateTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> properties)Start a transaction to create a table.default TransactionnewCreateTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties)Start a transaction to create a table.default TransactionnewReplaceTableTransaction(TableIdentifier identifier, Schema schema, boolean orCreate)Start a transaction to replace a table.default TransactionnewReplaceTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, boolean orCreate)Start a transaction to replace a table.default TransactionnewReplaceTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> properties, boolean orCreate)Start a transaction to replace a table.default TransactionnewReplaceTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties, boolean orCreate)Start a transaction to replace a table.default TableregisterTable(TableIdentifier identifier, java.lang.String metadataFileLocation)Register a table with the catalog if it does not exist.voidrenameTable(TableIdentifier from, TableIdentifier to)Rename a table.default booleantableExists(TableIdentifier identifier)Check whether table exists.
 
- 
- 
- 
Method Detail- 
namedefault java.lang.String name() Return the name for this catalog.- Returns:
- this catalog's name
 
 - 
listTablesjava.util.List<TableIdentifier> listTables(Namespace namespace) Return all the identifiers under this namespace.- Parameters:
- namespace- a namespace
- Returns:
- a list of identifiers for tables
- Throws:
- NotFoundException- if the namespace is not found
 
 - 
createTabledefault Table createTable(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> properties) Create a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- location- a location for the table; leave null if unspecified
- properties- a string map of table properties
- Returns:
- a Table instance
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
createTabledefault Table createTable(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties) Create a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- properties- a string map of table properties
- Returns:
- a Table instance
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
createTabledefault Table createTable(TableIdentifier identifier, Schema schema, PartitionSpec spec) Create a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- Returns:
- a Table instance
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
createTabledefault Table createTable(TableIdentifier identifier, Schema schema) Create an unpartitioned table.- Parameters:
- identifier- a table identifier
- schema- a schema
- Returns:
- a Table instance
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
newCreateTableTransactiondefault Transaction newCreateTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> properties) Start a transaction to create a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- location- a location for the table; leave null if unspecified
- properties- a string map of table properties
- Returns:
- a Transactionto create the table
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
newCreateTableTransactiondefault Transaction newCreateTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties) Start a transaction to create a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- properties- a string map of table properties
- Returns:
- a Transactionto create the table
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
newCreateTableTransactiondefault Transaction newCreateTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec) Start a transaction to create a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- Returns:
- a Transactionto create the table
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
newCreateTableTransactiondefault Transaction newCreateTableTransaction(TableIdentifier identifier, Schema schema) Start a transaction to create a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- Returns:
- a Transactionto create the table
- Throws:
- AlreadyExistsException- if the table already exists
 
 - 
newReplaceTableTransactiondefault Transaction newReplaceTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.lang.String location, java.util.Map<java.lang.String,java.lang.String> properties, boolean orCreate) Start a transaction to replace a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- location- a location for the table; leave null if unspecified
- properties- a string map of table properties
- orCreate- whether to create the table if not exists
- Returns:
- a Transactionto replace the table
- Throws:
- NoSuchTableException- if the table doesn't exist and orCreate is false
 
 - 
newReplaceTableTransactiondefault Transaction newReplaceTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, java.util.Map<java.lang.String,java.lang.String> properties, boolean orCreate) Start a transaction to replace a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- properties- a string map of table properties
- orCreate- whether to create the table if not exists
- Returns:
- a Transactionto replace the table
- Throws:
- NoSuchTableException- if the table doesn't exist and orCreate is false
 
 - 
newReplaceTableTransactiondefault Transaction newReplaceTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, boolean orCreate) Start a transaction to replace a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- spec- a partition spec
- orCreate- whether to create the table if not exists
- Returns:
- a Transactionto replace the table
- Throws:
- NoSuchTableException- if the table doesn't exist and orCreate is false
 
 - 
newReplaceTableTransactiondefault Transaction newReplaceTableTransaction(TableIdentifier identifier, Schema schema, boolean orCreate) Start a transaction to replace a table.- Parameters:
- identifier- a table identifier
- schema- a schema
- orCreate- whether to create the table if not exists
- Returns:
- a Transactionto replace the table
- Throws:
- NoSuchTableException- if the table doesn't exist and orCreate is false
 
 - 
tableExistsdefault boolean tableExists(TableIdentifier identifier) Check whether table exists.- Parameters:
- identifier- a table identifier
- Returns:
- true if the table exists, false otherwise
 
 - 
dropTabledefault boolean dropTable(TableIdentifier identifier) Drop a table and delete all data and metadata files.- Parameters:
- identifier- a table identifier
- Returns:
- true if the table was dropped, false if the table did not exist
 
 - 
dropTableboolean dropTable(TableIdentifier identifier, boolean purge) Drop a table; optionally delete data and metadata files.If purge is set to true the implementation should delete all data and metadata files. - Parameters:
- identifier- a table identifier
- purge- if true, delete all data and metadata files in the table
- Returns:
- true if the table was dropped, false if the table did not exist
 
 - 
renameTablevoid renameTable(TableIdentifier from, TableIdentifier to) Rename a table.- Parameters:
- from- identifier of the table to rename
- to- new table name
- Throws:
- NoSuchTableException- if the from table does not exist
- AlreadyExistsException- if the to table already exists
 
 - 
loadTableTable loadTable(TableIdentifier identifier) Load a table.- Parameters:
- identifier- a table identifier
- Returns:
- instance of Tableimplementation referred bytableIdentifier
- Throws:
- NoSuchTableException- if the table does not exist
 
 - 
invalidateTabledefault void invalidateTable(TableIdentifier identifier) 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. - Parameters:
- identifier- a table identifier
 
 - 
registerTabledefault Table registerTable(TableIdentifier identifier, java.lang.String metadataFileLocation) Register a table with the catalog if it does not exist.- Parameters:
- identifier- a table identifier
- metadataFileLocation- the location of a metadata file
- Returns:
- a Table instance
- Throws:
- AlreadyExistsException- if the table already exists in the catalog.
 
 - 
buildTabledefault Catalog.TableBuilder buildTable(TableIdentifier identifier, Schema schema) /** Instantiate a builder to either create a table or start a create/replace transaction.- Parameters:
- identifier- a table identifier
- schema- a schema
- Returns:
- the builder to create a table or start a create/replace transaction
 
 - 
initializedefault void initialize(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties)Initialize a catalog given a custom name and a map of catalog properties.A custom Catalog implementation must have a no-arg constructor. A compute engine like Spark or Flink will first initialize the catalog without any arguments, and then call this method to complete catalog initialization with properties passed into the engine. - Parameters:
- name- a custom name for the catalog
- properties- catalog properties
 
 
- 
 
-