{"record":{"id":"f65bed138eb1959c","repo":"apache/iceberg","slug":"does-not-support-table-invalidation-f65bed","errorCode":null,"errorMessage":" does not support table invalidation","messagePattern":" does not support table invalidation","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java","lineNumber":71,"sourceCode":"      throw new NoSuchTableException(ident);\n    }\n\n    return new SparkRewriteTable(table, groupId);\n  }\n\n  @Override\n  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(Identifier ident, TableInfo tableInfo)\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","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java#L53-L89","documentation":"SparkRewriteTableCatalog.invalidateTable(ident) always throws UnsupportedOperationException because the catalog does not own table metadata (it reads from a short-lived cache); there is nothing to invalidate and cache eviction is managed by the rewrite machinery.","triggerScenarios":"Calling invalidateTable(ident) on SparkRewriteTableCatalog directly, or Spark's session catalog cache refresh logic probing this catalog after DML.","commonSituations":"Framework code that invalidates cached tables generically across all registered catalogs; manual cache-busting attempts against the rewrite catalog.","solutions":["Do not call invalidateTable on the rewrite catalog; it holds no authoritative table state.","Invalidate on the real catalog (SparkCatalog.invalidateTable) if a refresh is needed.","Let the rewrite procedure's SparkTableCache lifecycle manage entry freshness."],"exampleFix":"// before\nrewriteCatalog.invalidateTable(ident);\n// after\nsparkCatalog.invalidateTable(ident); // refresh via the real catalog","handlingStrategy":"type-guard","validationCode":"if (catalog instanceof SparkRewriteTableCatalog) {\n  throw new UnsupportedOperationException(\"invalidateTable not supported on rewrite catalog\");\n}","typeGuard":"boolean supportsInvalidation(CatalogPlugin c) {\n  return !(c instanceof SparkRewriteTableCatalog);\n}","tryCatchPattern":"try {\n  catalog.invalidateTable(ident);\n} catch (UnsupportedOperationException e) {\n  realCatalog.invalidateTable(ident); // refresh via the authoritative catalog\n}","preventionTips":["Skip invalidation for procedure-scoped catalogs.","Invalidate on SparkCatalog/HiveCatalog instead.","Let SparkTableCache manage its own lifecycle.","Avoid generic refresh code that assumes all catalogs support invalidation."],"tags":["spark","rewrite","unsupported-operation","cache"],"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-14T16:17:12.679Z"}