apache/iceberg · error · UnsupportedOperationException

does not support dropping tables

Error message

 does not support dropping tables

What it means

This UnsupportedOperationException is a deliberate guard in SparkCachedTableCatalog.dropTable: cached tables are read-only handles, so the catalog cannot remove the underlying Iceberg table from its parent catalog. DROP TABLE statements (with or without EXTERNAL/PURGE qualifiers) that Spark routes to this catalog raise this sentinel unconditionally and return no boolean result.

Solutions

  1. Drop the table through the owning Iceberg catalog (SparkCatalog)
  2. Remove entries from SparkTableCache explicitly instead of dropping
  3. Qualify DROP TABLE with the real catalog name
Defensive patterns

Strategy: validation

Validate before calling

if (catalog instanceof SparkCachedTableCatalog) {
  throw new IllegalArgumentException("DROP TABLE not supported on cached catalog; use owning catalog");
}

Try / catch

try { catalog.dropTable(ident); } catch (UnsupportedOperationException e) { realCatalog.dropTable(ident); }

Prevention

When it happens

Trigger: Running DROP TABLE against a table identifier owned by the cached-table catalog.

Common situations: Cleanup scripts or test teardown that assume the catalog is a persistent Iceberg catalog.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/0dd2d1a5e5d22c9c. Report an issue: GitHub.

Appendix: source

Thrown at spark/v4.0/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;
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)