Implementation:Apache Paimon CatalogTableType
| Knowledge Sources | |
|---|---|
| Domains | Catalog Management, Table Types |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
CatalogTableType is an enumeration defining the types of tables managed by a Paimon catalog, distinguishing between managed and external tables.
Description
CatalogTableType is a public enum implementing DescribedEnum that defines two fundamental table categories in Apache Paimon's catalog system: MANAGED and EXTERNAL. MANAGED tables represent tables where Paimon owns the entire lifecycle including data storage, metadata, and cleanup - the catalog has full control over the table's existence and location. EXTERNAL tables represent a looser coupling where Paimon provides query and management capabilities over data stored in external locations, but does not control the underlying data lifecycle.
Each enum constant is associated with a string value for serialization ("managed" or "external") and a human-readable description. The MANAGED type is described as "Paimon owned table where the entire lifecycle of the table data is managed," while EXTERNAL is "The table where Paimon has loose coupling with the data stored in external locations." The enum implements getDescription() to return descriptive text elements, supporting Paimon's configuration and documentation infrastructure.
This distinction affects behavior such as whether dropping a table also deletes the underlying data (MANAGED: yes, EXTERNAL: typically no), where metadata is stored, and what operations are permitted. The toString() method returns the lowercase string value, providing a standard string representation for configuration files, APIs, and logs.
Usage
Use CatalogTableType when creating tables programmatically to specify ownership semantics, when implementing catalog operations that behave differently for managed vs external tables, or when querying table metadata to determine data lifecycle responsibilities.
Code Reference
Source Location
- Repository: Apache_Paimon
- File: paimon-api/src/main/java/org/apache/paimon/table/CatalogTableType.java
Signature
public enum CatalogTableType implements DescribedEnum {
MANAGED("managed",
"Paimon owned table where the entire lifecycle of the table data is managed."),
EXTERNAL("external",
"The table where Paimon has loose coupling with the data stored in external locations.");
@Override
public String toString()
@Override
public InlineElement getDescription()
}
Import
import org.apache.paimon.table.CatalogTableType;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Table type constant | CatalogTableType | Yes | Either MANAGED or EXTERNAL |
Outputs
| Name | Type | Description |
|---|---|---|
| Type enum | CatalogTableType | The table type classification |
| String value | String | Lowercase string "managed" or "external" |
| Description | InlineElement | Human-readable description of the type |
Usage Examples
// Using catalog table types
CatalogTableType managed = CatalogTableType.MANAGED;
CatalogTableType external = CatalogTableType.EXTERNAL;
// Get string representation
String managedStr = managed.toString(); // "managed"
String externalStr = external.toString(); // "external"
// Get description
InlineElement managedDesc = managed.getDescription();
// Returns text: "Paimon owned table where the entire lifecycle..."
// Example: Create table with specific type
public void createTable(String tableName, CatalogTableType type) {
if (type == CatalogTableType.MANAGED) {
// Paimon manages data lifecycle
createManagedTable(tableName);
} else {
// Data exists externally
createExternalTable(tableName);
}
}
// Example: Drop behavior based on type
public void dropTable(Table table, CatalogTableType type) {
if (type == CatalogTableType.MANAGED) {
// Delete data when dropping managed table
deleteTableData(table);
deleteTableMetadata(table);
} else {
// Only remove metadata for external table
deleteTableMetadata(table);
}
}
// Example: Check table type
public boolean isTableManaged(CatalogTableType type) {
return type == CatalogTableType.MANAGED;
}
// Example: Table creation in catalog
CatalogTableType tableType = CatalogTableType.MANAGED;
catalog.createTable(
new ObjectPath("my_database", "my_table"),
tableSchema,
false, // ignoreIfExists
tableType
);
// Example: Conditional operations
public void performOperation(String tableName, CatalogTableType type) {
switch (type) {
case MANAGED:
System.out.println("Operating on managed table: " + tableName);
// Full control over data lifecycle
break;
case EXTERNAL:
System.out.println("Operating on external table: " + tableName);
// Limited control, data managed elsewhere
break;
}
}
// Configuration usage
Map<String, String> tableOptions = new HashMap<>();
tableOptions.put("table.type", CatalogTableType.MANAGED.toString());