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");
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Create tables via the real catalog: SparkCatalog, HadoopCatalog, HiveCatalog, or REST catalog.
  2. Use SQL CREATE TABLE against the source catalog, never the rewrite catalog.
  3. 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

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


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