{"record":{"id":"f9d6b5c87a168264","repo":"apache/iceberg","slug":"does-not-support-renaming-tables","errorCode":null,"errorMessage":" does not support renaming tables","messagePattern":" does not support renaming tables","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCachedTableCatalog.java","lineNumber":118,"sourceCode":"\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 {\n    Preconditions.checkArgument(\n        ident.namespace().length == 0, CLASS_NAME + \" does not support namespaces\");\n\n    Pair<String, List<String>> parsedIdent = parseIdent(ident);\n    String key = parsedIdent.first();","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCachedTableCatalog.java#L100-L136","documentation":"This UnsupportedOperationException is a deliberate guard in SparkCachedTableCatalog.renameTable: the catalog maintains a cache keyed by table identifier and cannot move or re-key an entry, nor can it rename the table in the catalog that actually owns it. ALTER TABLE ... RENAME TO statements resolved through this catalog raise this sentinel unconditionally, with no side effects on the cached or underlying table.","triggerScenarios":"Running ALTER TABLE ... RENAME TO or Catalog#renameTable on identifiers belonging to the cached-table catalog.","commonSituations":"Migration/refactoring scripts renaming tables routed to the wrong catalog; Spark session catalog misconfiguration.","solutions":["Rename the table in the owning Iceberg catalog","Re-cache under the new identifier after renaming in the real catalog","Qualify the RENAME with the real catalog name"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (catalog instanceof SparkCachedTableCatalog) {\n  throw new IllegalArgumentException(\"RENAME not supported on cached catalog; use owning catalog\");\n}","typeGuard":null,"tryCatchPattern":"try { catalog.renameTable(oldIdent, newIdent); } catch (UnsupportedOperationException e) { realCatalog.renameTable(oldIdent, newIdent); }","preventionTips":["Perform renames in the owning Iceberg catalog, then re-cache under the new key","Check catalog prefix in RENAME statements"],"tags":["spark","catalog","ddl","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"}