{"record":{"id":"69a6c817dd20853e","repo":"apache/iceberg","slug":"does-not-support-purging-tables","errorCode":null,"errorMessage":" does not support purging tables","messagePattern":" does not support purging tables","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCachedTableCatalog.java","lineNumber":113,"sourceCode":"  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\n  public void renameTable(Identifier oldIdent, Identifier newIdent) {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support renaming tables\");\n  }\n\n  @Override\n  public void initialize(String catalogName, CaseInsensitiveStringMap options) {\n    this.name = catalogName;\n  }\n\n  @Override\n  public String name() {\n    return name;\n  }\n\n  private SparkTable load(Identifier ident) throws NoSuchTableException {","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCachedTableCatalog.java#L95-L131","documentation":"This UnsupportedOperationException is a deliberate guard in SparkCachedTableCatalog.purgeTable: purging means deleting a table plus all of its data/metadata files, which is a destructive operation on the backing Iceberg table that a cache-only catalog does not perform. Any DROP TABLE ... PURGE (or catalog purgeTable call) routed here hits this unconditional sentinel instead of touching storage.","triggerScenarios":"Running DROP TABLE ... PURGE (or an engine call to purgeTable) on a table resolved via the cached-table catalog.","commonSituations":"Lifecycle-management jobs issuing PURGE against every table in a namespace, hitting this passthrough catalog.","solutions":["Purge the table via the real Iceberg catalog","Exclude cached-catalog tables from purge tooling","Use expire_snapshots / purge procedures against the owning catalog instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (catalog instanceof SparkCachedTableCatalog) {\n  throw new IllegalArgumentException(\"PURGE not supported on cached catalog; use owning catalog\");\n}","typeGuard":null,"tryCatchPattern":"try { catalog.purgeTable(ident); } catch (UnsupportedOperationException e) { realCatalog.purgeTable(ident); }","preventionTips":["Run purge procedures against the persistent catalog","Filter lifecycle jobs to catalogs that support purging"],"tags":["spark","catalog","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"}