{"record":{"id":"c0ee9aaba9513ca1","repo":"apache/iceberg","slug":"class-name-does-not-support-time-travel","errorCode":null,"errorMessage":"${CLASS_NAME} does not support time travel","messagePattern":"(.+?) does not support time travel","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java","lineNumber":63,"sourceCode":"  }\n\n  @Override\n  public SparkRewriteTable loadTable(Identifier ident) throws NoSuchTableException {\n    validateNoNamespace(ident);\n\n    String groupId = ident.name();\n    Table table = TABLE_CACHE.get(groupId);\n\n    if (table == null) {\n      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(\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  }","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java#L45-L81","documentation":"SparkRewriteTableCatalog rejects the versioned loadTable(ident, version) overload because time travel is meaningless for its procedure-scoped table cache. Any attempt throws UnsupportedOperationException naming the class.","triggerScenarios":"Calling loadTable(ident, version) (or a Spark query with VERSION AS OF / FOR SYSTEM_VERSION AS OF) against a catalog bound to SparkRewriteTableCatalog.","commonSituations":"Running time-travel queries while a rewrite catalog binding is active; framework code resolving tables with the versioned overload during a rewrite.","solutions":["Do not combine time travel with the rewrite-table procedure catalog","Use SparkCatalog (the normal Iceberg catalog) for time-travel reads","Complete the rewrite procedure first, then query with time travel via the regular catalog"],"exampleFix":"// before\nspark.read.option(\"version-as-of\", 5).table(\"prod.db.events\") // via rewrite catalog\n// after\nspark.sql(\"CALL prod.system.rewrite_data_files(table => 'db.events')\") // no time travel in rewrite catalog","handlingStrategy":"validation","validationCode":"require(!queryOptions.contains(\"version-as-of\"), \"time travel not supported through rewrite catalog\")","typeGuard":null,"tryCatchPattern":"try {\n  catalog.loadTable(ident, version)\n} catch {\n  case _: UnsupportedOperationException => loadWithoutTimeTravel(ident)\n}","preventionTips":["Never combine VERSION AS OF with rewrite procedures","Keep time-travel reads on SparkCatalog","Run rewrites and reads in separate sessions/bindings"],"tags":["spark","time-travel","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-14T16:17:12.679Z"}