apache/iceberg · error · UnsupportedOperationException
does not support renaming tables
Error message
does not support renaming tables
What it means
renameTable on SparkRewriteTableCatalog throws UnsupportedOperationException because renaming is not supported by this staged-rewrite-only catalog adapter. Like drop/purge, it is intentionally unimplemented; the class only implements createTable/instantiateTable/stageReplace paths needed for CREATE OR REPLACE.
Source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java:97
@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");
}
@Override
public void renameTable(Identifier oldIdent, Identifier newIdent) {
throw new UnsupportedOperationException(CLASS_NAME + " does not support renaming tables");
}
@Override
public void initialize(String catalogName, CaseInsensitiveStringMap options) {
this.name = catalogName;
}
@Override
public String name() {
return name;
}
private void validateNoNamespace(Identifier ident) {
Preconditions.checkArgument(
ident.namespace().length == 0,
"%s does not support namespaces, but got: %s",
CLASS_NAME,
String.join(".", ident.namespace()));View on GitHub (pinned to 86d9c8fc54)
Solutions
- Rename through the real underlying catalog (Hive Metastore, JDBC, etc.) rather than the Spark rewrite adapter
- Register an Iceberg SparkCatalog and perform ALTER TABLE ... RENAME TO against it
- Use engine-neutral APIs (e.g. Hive client) if the table is a non-Iceberg session table
Example fix
// before
sparkRewriteCatalog.renameTable(from, to);
// after
spark.sql("ALTER TABLE iceberg.db.tbl RENAME TO iceberg.db.tbl_new"); Defensive patterns
Strategy: fallback
Try / catch
try {
catalog.renameTable(from, to);
} catch (UnsupportedOperationException e) {
// delegate rename to the underlying metastore/catalog
} Prevention
- Issue renames against the true backing catalog (Hive/JDBC/REST), not the rewrite adapter
- Document that SparkRewriteTableCatalog only supports staged create/replace paths
When it happens
Trigger: Calling ALTER TABLE ... RENAME TO on a table resolved through SparkRewriteTableCatalog, or calling renameTable directly on an instance.
Common situations: Spark session catalog handling renames of non-Iceberg session tables via this adapter; migration scripts that assume spark_catalog supports rename for all table types.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Renaming a view is not supported by catalog:
- Renaming a view is not supported by catalog: ${catalogName}
- SparkCachedTableCatalog does not support altering tables
- SparkCachedTableCatalog does not support dropping tables
- SparkCachedTableCatalog does not support purging tables
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/de55e7263290835a.
Report an issue: GitHub.