apache/iceberg · error · UnsupportedOperationException

does not support creating tables

Error message

${CLASS_NAME} does not support creating tables

What it means

SparkRewriteTableCatalog.createTable always throws UnsupportedOperationException: the rewrite catalog exists solely to load tables staged by a rewrite procedure and can never create tables. There is no backing store for new table metadata.

Solutions

  1. Create tables through SparkCatalog or another real Iceberg catalog
  2. Check spark.sql.catalog.<name>.catalog-impl is a full catalog implementation, not the rewrite one
  3. Run DDL via the normal catalog namespace before invoking rewrite procedures

Example fix

// before
spark.sql("CREATE TABLE prod.db.events (...)") // catalog bound to SparkRewriteTableCatalog
// after
spark.conf.set("spark.sql.catalog.prod.catalog-impl", "org.apache.iceberg.spark.SparkCatalog")
spark.sql("CREATE TABLE prod.db.events (...)")
Defensive patterns

Strategy: validation

Validate before calling

val impl = spark.conf.get("spark.sql.catalog.prod.catalog-impl", "")
require(impl != "org.apache.iceberg.spark.SparkRewriteTableCatalog", "CREATE TABLE not supported on rewrite catalog")

Try / catch

try {
  catalog.createTable(ident, schema, partitions, props)
} catch {
  case _: UnsupportedOperationException => createViaRealCatalog(ident, schema, partitions, props)
}

Prevention

When it happens

Trigger: Calling createTable(ident, schema, partitions, properties) on a SparkRewriteTableCatalog, e.g. CREATE TABLE statements executed while that catalog binding is active.

Common situations: CREATE TABLE pointed at a catalog bound to SparkRewriteTableCatalog; framework code programmatically creating tables during a rewrite session.

Related errors


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

Appendix: source

Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java:80

  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, 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

View on GitHub (pinned to 86d9c8fc54)