apache/iceberg · error · UnsupportedOperationException
does not support creating tables
Error message
does not support creating tables
What it means
SparkRewriteTableCatalog.createTable(ident, tableInfo) always throws UnsupportedOperationException because this catalog only serves already-existing tables registered by rewrite procedures; table creation must go through a real Iceberg catalog.
Source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java:77
@Override
public SparkTable loadTable(Identifier ident, String version) throws NoSuchTableException {
throw new UnsupportedOperationException(CLASS_NAME + " does not support time travel");
}
@Override
public SparkTable loadTable(Identifier ident, long timestampMicros) throws NoSuchTableException {
throw new UnsupportedOperationException(CLASS_NAME + " does not support time travel");
}
@Override
public void invalidateTable(Identifier ident) {
throw new UnsupportedOperationException(CLASS_NAME + " does not support table invalidation");
}
@Override
public SparkTable createTable(Identifier ident, TableInfo tableInfo)
throws TableAlreadyExistsException {
throw new UnsupportedOperationException(CLASS_NAME + " does not support creating tables");
}
@Override
public SparkTable alterTable(Identifier ident, TableChange... changes) {
throw new UnsupportedOperationException(CLASS_NAME + " does not support altering tables");
}
@Override
public boolean dropTable(Identifier ident) {
throw new UnsupportedOperationException(CLASS_NAME + " does not support dropping tables");
}
@Override
public boolean purgeTable(Identifier ident) throws UnsupportedOperationException {
throw new UnsupportedOperationException(CLASS_NAME + " does not support purging tables");
}
@OverrideView on GitHub (pinned to 86d9c8fc54)
Solutions
- Create tables via the real catalog: SparkCatalog, HadoopCatalog, HiveCatalog, or REST catalog.
- Use SQL CREATE TABLE against the source catalog, never the rewrite catalog.
- Do not register SparkRewriteTableCatalog as a default catalog for DDL workloads.
Example fix
// before rewriteCatalog.createTable(ident, tableInfo); // after sparkCatalog.createTable(ident, schema, spec, properties); // DDL via the real catalog
Defensive patterns
Strategy: validation
Validate before calling
if (catalog instanceof SparkRewriteTableCatalog) {
throw new IllegalArgumentException("CREATE TABLE must target a real Iceberg catalog");
} Type guard
boolean supportsCreate(CatalogPlugin c) {
return !(c instanceof SparkRewriteTableCatalog);
} Try / catch
try {
catalog.createTable(ident, tableInfo);
} catch (UnsupportedOperationException e) {
realCatalog.createTable(ident, schema, spec, properties);
} Prevention
- Register SparkRewriteTableCatalog only for rewrite procedures.
- Route DDL to the source catalog.
- Audit catalog configuration for default-catalog mistakes.
- Capability-check before DDL.
When it happens
Trigger: Calling createTable on SparkRewriteTableCatalog, or a generic catalog client attempting DDL (CREATE TABLE) against the rewrite catalog identifier.
Common situations: Configuring the rewrite catalog as a default/session catalog so CREATE TABLE routes to it; automated DDL migrations that iterate all catalogs.
Related errors
- does not support altering tables
- SparkCachedTableCatalog does not support altering tables
- SparkCachedTableCatalog does not support dropping tables
- SparkCachedTableCatalog does not support purging tables
- SparkCachedTableCatalog does not support renaming tables
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/2c7d782692ce4694.
Report an issue: GitHub.