{"record":{"id":"09b7f883b5d35191","repo":"apache/iceberg","slug":"class-name-does-not-support-creating-tables","errorCode":null,"errorMessage":"${CLASS_NAME} does not support creating tables","messagePattern":"(.+?) does not support creating tables","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java","lineNumber":80,"sourceCode":"  public SparkTable loadTable(Identifier ident, String version) throws NoSuchTableException {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support time travel\");\n  }\n\n  @Override\n  public SparkTable loadTable(Identifier ident, long timestampMicros) throws NoSuchTableException {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support time travel\");\n  }\n\n  @Override\n  public void invalidateTable(Identifier ident) {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support table invalidation\");\n  }\n\n  @Override\n  public SparkTable createTable(\n      Identifier ident, StructType schema, Transform[] partitions, Map<String, String> properties)\n      throws TableAlreadyExistsException {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support creating tables\");\n  }\n\n  @Override\n  public SparkTable alterTable(Identifier ident, TableChange... changes) {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support altering tables\");\n  }\n\n  @Override\n  public boolean dropTable(Identifier ident) {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support dropping tables\");\n  }\n\n  @Override\n  public boolean purgeTable(Identifier ident) throws UnsupportedOperationException {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support purging tables\");\n  }\n\n  @Override","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java#L62-L98","documentation":"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.","triggerScenarios":"Calling createTable(ident, schema, partitions, properties) on a SparkRewriteTableCatalog, e.g. CREATE TABLE statements executed while that catalog binding is active.","commonSituations":"CREATE TABLE pointed at a catalog bound to SparkRewriteTableCatalog; framework code programmatically creating tables during a rewrite session.","solutions":["Create tables through SparkCatalog or another real Iceberg catalog","Check spark.sql.catalog.<name>.catalog-impl is a full catalog implementation, not the rewrite one","Run DDL via the normal catalog namespace before invoking rewrite procedures"],"exampleFix":"// before\nspark.sql(\"CREATE TABLE prod.db.events (...)\") // catalog bound to SparkRewriteTableCatalog\n// after\nspark.conf.set(\"spark.sql.catalog.prod.catalog-impl\", \"org.apache.iceberg.spark.SparkCatalog\")\nspark.sql(\"CREATE TABLE prod.db.events (...)\")","handlingStrategy":"validation","validationCode":"val impl = spark.conf.get(\"spark.sql.catalog.prod.catalog-impl\", \"\")\nrequire(impl != \"org.apache.iceberg.spark.SparkRewriteTableCatalog\", \"CREATE TABLE not supported on rewrite catalog\")","typeGuard":null,"tryCatchPattern":"try {\n  catalog.createTable(ident, schema, partitions, props)\n} catch {\n  case _: UnsupportedOperationException => createViaRealCatalog(ident, schema, partitions, props)\n}","preventionTips":["Point CREATE TABLE at SparkCatalog or a real Iceberg catalog","Audit catalog-impl settings in cluster Spark configs","Do DDL before/after rewrite procedure calls"],"tags":["spark","catalog","create-table","unsupported-operation"],"backgroundTag":"operation-not-supported","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}