apache/iceberg · error · UnsupportedOperationException
does not support dropping tables
Error message
${CLASS_NAME} does not support dropping tables What it means
SparkRewriteTableCatalog is a build-and-commit catalog used only for staged rewrite procedures (e.g. REWRITE DATA FILES). It intentionally implements table mutation methods as unsupported: dropping a table through it would bypass the rewrite protocol, so any dropTable call throws UnsupportedOperationException with the catalog class name.
Solutions
- Use SparkCatalog (org.apache.iceberg.spark.SparkCatalog) or SparkSessionCatalog as the catalog implementation for DDL operations
- Register the rewrite catalog only for procedure-style rewrite usage, not as the session default catalog
- Catch UnsupportedOperationException and route DDL to the real Hive/REST/Hadoop catalog
Example fix
// before spark.sql.catalog.ice = org.apache.iceberg.spark.SparkRewriteTableCatalog // after spark.sql.catalog.ice = org.apache.iceberg.spark.SparkCatalog
Defensive patterns
Strategy: try-catch
Validate before calling
// verify the catalog supports mutation before DDL
if (catalog instanceof SparkRewriteTableCatalog) {
throw new IllegalStateException("Route DDL to a full catalog, not the rewrite catalog");
} Type guard
boolean supportsDdl(CatalogPlugin c) {
return c instanceof SparkCatalog || c instanceof SparkSessionCatalog;
} Try / catch
try {
catalog.dropTable(ident);
} catch (UnsupportedOperationException e) {
// fall back to the production catalog
prodCatalog.dropTable(ident);
} Prevention
- Register SparkRewriteTableCatalog only for rewrite procedure sessions
- Default session catalogs to SparkCatalog/SparkSessionCatalog
- Audit spark.sql.catalog.* implementation configs in deployment templates
When it happens
Trigger: Calling dropTable(ident) on a catalog registered as org.apache.iceberg.spark.SparkRewriteTableCatalog, e.g. running DROP TABLE against a Spark session whose session/catalog config points at the rewrite catalog, or invoking SparkCatalog/Spark3Util paths that delegate mutation to it.
Common situations: Misconfigured spark.sql.catalog.<name>.implementation pointing at SparkRewriteTableCatalog instead of SparkCatalog; SQL scripts that assume all Iceberg catalogs support DDL; automated table lifecycle jobs hitting the wrong catalog.
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
- Altering a view is not supported by catalog:
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
- Cannot apply unknown table change
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ebfe1a6e40d3d976.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java:90
public void invalidateTable(Identifier ident) {
throw new UnsupportedOperationException(CLASS_NAME + " does not support table invalidation");
}
@Override
public SparkTable createTable(
Identifier ident, StructType schema, Transform[] partitions, Map<String, String> properties)
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");
}
@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;
}
@OverrideView on GitHub (pinned to 86d9c8fc54)