apache/iceberg · error · java.lang.UnsupportedOperationException
SparkCachedTableCatalog does not support dropping tables
Error message
SparkCachedTableCatalog does not support dropping tables
What it means
SparkCachedTableCatalog.dropTable() unconditionally throws UnsupportedOperationException. The cached catalog only reads tables into a cache; it has no authority (or mechanism) to delete the underlying table from its owning catalog, so dropping is rejected by design.
Source
Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCachedTableCatalog.java:108
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)
Solutions
- Issue the DROP TABLE against the catalog that owns the table (e.g. the SparkSession catalog the table was cached from).
- Use Spark SQL with the fully qualified original identifier (spark_catalog.db.t) rather than the cached namespace.
- If programmatic, obtain the org.apache.iceberg.catalog.SupportsDelete catalog and call dropTable there.
Example fix
// before
cachedCatalog.dropTable(Identifier.of(new String[]{"db"}, "t"));
// after
spark.sql("DROP TABLE spark_catalog.db.t"); // resolves to the owning catalog Defensive patterns
Strategy: validation
Validate before calling
if (catalog instanceof SparkCachedTableCatalog) {
throw new IllegalArgumentException("dropTable is not supported on SparkCachedTableCatalog; use the owning catalog");
} Type guard
boolean canDrop = !(catalog instanceof SparkCachedTableCatalog);
Try / catch
try {
catalog.dropTable(ident);
} catch (UnsupportedOperationException e) {
// fall back to owning catalog: spark.sql("DROP TABLE spark_catalog.db.t")
} Prevention
- Never build cleanup/retention jobs on top of the cached catalog.
- Resolve the owning catalog from the original identifier before destructive operations.
- Add unit checks in tooling that DDL targets SparkCatalog/HiveCatalog, never the cached wrapper.
When it happens
Trigger: Calling SparkCachedTableCatalog.dropTable(ident), or executing DROP TABLE in Spark SQL when the identifier resolves to the cached-table catalog.
Common situations: Cleanup scripts that DROP TABLE a list of names without knowing which catalog resolved them; test harnesses assuming any CatalogPlugin supports drop; user runs DROP TABLE after querying via the cached path and expects the drop to hit the source table.
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
- SparkCachedTableCatalog does not support altering tables
- SparkCachedTableCatalog does not support purging tables
- SparkCachedTableCatalog does not support renaming tables
- does not support creating tables
- does not support altering tables
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/782fdeb17861f7dc.
Report an issue: GitHub.