Package org.apache.iceberg.catalog
Interface Catalog
-
- All Known Implementing Classes:
BaseMetastoreCatalog,CachingCatalog,HadoopCatalog,HiveCatalog
public interface CatalogA Catalog API for table create, drop, and load operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default TablecreateTable(TableIdentifier identifier, Schema schema)Create an unpartitioned table.default TablecreateTable(TableIdentifier identifier, Schema schema, PartitionSpec spec)Create a table.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.java.util.List<TableIdentifier>listTables(Namespace namespace)Return all the identifiers under this namespace.TableloadTable(TableIdentifier identifier)Load a table.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.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.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.voidrenameTable(TableIdentifier from, TableIdentifier to)Rename a table.default booleantableExists(TableIdentifier identifier)Check whether table exists.
-
-
-
Method Detail
-
listTables
java.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
-
createTable
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 identifierschema- a schemaspec- a partition speclocation- a location for the table; leave null if unspecifiedproperties- a string map of table properties- Returns:
- a Table instance
- Throws:
AlreadyExistsException- if the table already exists
-
createTable
default 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 identifierschema- a schemaspec- a partition specproperties- a string map of table properties- Returns:
- a Table instance
- Throws:
AlreadyExistsException- if the table already exists
-
createTable
default Table createTable(TableIdentifier identifier, Schema schema, PartitionSpec spec)
Create a table.- Parameters:
identifier- a table identifierschema- a schemaspec- a partition spec- Returns:
- a Table instance
- Throws:
AlreadyExistsException- if the table already exists
-
createTable
default Table createTable(TableIdentifier identifier, Schema schema)
Create an unpartitioned table.- Parameters:
identifier- a table identifierschema- a schema- Returns:
- a Table instance
- Throws:
AlreadyExistsException- if the table already exists
-
newCreateTableTransaction
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 identifierschema- a schemaspec- a partition speclocation- a location for the table; leave null if unspecifiedproperties- a string map of table properties- Returns:
- a
Transactionto create the table - Throws:
AlreadyExistsException- if the table already exists
-
newCreateTableTransaction
default 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 identifierschema- a schemaspec- a partition specproperties- a string map of table properties- Returns:
- a
Transactionto create the table - Throws:
AlreadyExistsException- if the table already exists
-
newCreateTableTransaction
default Transaction newCreateTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec)
Start a transaction to create a table.- Parameters:
identifier- a table identifierschema- a schemaspec- a partition spec- Returns:
- a
Transactionto create the table - Throws:
AlreadyExistsException- if the table already exists
-
newCreateTableTransaction
default Transaction newCreateTableTransaction(TableIdentifier identifier, Schema schema)
Start a transaction to create a table.- Parameters:
identifier- a table identifierschema- a schema- Returns:
- a
Transactionto create the table - Throws:
AlreadyExistsException- if the table already exists
-
newReplaceTableTransaction
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 identifierschema- a schemaspec- a partition speclocation- a location for the table; leave null if unspecifiedproperties- a string map of table propertiesorCreate- 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
-
newReplaceTableTransaction
default 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 identifierschema- a schemaspec- a partition specproperties- a string map of table propertiesorCreate- 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
-
newReplaceTableTransaction
default Transaction newReplaceTableTransaction(TableIdentifier identifier, Schema schema, PartitionSpec spec, boolean orCreate)
Start a transaction to replace a table.- Parameters:
identifier- a table identifierschema- a schemaspec- a partition specorCreate- 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
-
newReplaceTableTransaction
default Transaction newReplaceTableTransaction(TableIdentifier identifier, Schema schema, boolean orCreate)
Start a transaction to replace a table.- Parameters:
identifier- a table identifierschema- a schemaorCreate- 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
-
tableExists
default boolean tableExists(TableIdentifier identifier)
Check whether table exists.- Parameters:
identifier- a table identifier- Returns:
- true if the table exists, false otherwise
-
dropTable
default 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
-
dropTable
boolean 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 identifierpurge- 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
-
renameTable
void renameTable(TableIdentifier from, TableIdentifier to)
Rename a table.- Parameters:
from- identifier of the table to renameto- new table name- Throws:
NoSuchTableException- if the from table does not existAlreadyExistsException- if the to table already exists
-
loadTable
Table 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
-
-