apache/iceberg · error · UnsupportedOperationException

${CLASS_NAME} does not support time travel

Error message

${CLASS_NAME} does not support time travel

What it means

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.

Source

Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java:63

  }

  @Override
  public SparkRewriteTable loadTable(Identifier ident) throws NoSuchTableException {
    validateNoNamespace(ident);

    String groupId = ident.name();
    Table table = TABLE_CACHE.get(groupId);

    if (table == null) {
      throw new NoSuchTableException(ident);
    }

    return new SparkRewriteTable(table, groupId);
  }

  @Override
  public SparkTable loadTable(Identifier ident, String version) throws NoSuchTableException {
    throw new UnsupportedOperationException(CLASS_NAME + " does not support time travel");
  }

  @Override
  public SparkTable loadTable(Identifier ident, long timestampMicros) throws NoSuchTableException {
    throw new UnsupportedOperationException(CLASS_NAME + " does not support time travel");
  }

  @Override
  public void invalidateTable(Identifier ident) {
    throw new UnsupportedOperationException(CLASS_NAME + " does not support table invalidation");
  }

  @Override
  public SparkTable createTable(
      Identifier ident, StructType schema, Transform[] partitions, Map<String, String> properties)
      throws TableAlreadyExistsException {
    throw new UnsupportedOperationException(CLASS_NAME + " does not support creating tables");
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Do not combine time travel with the rewrite-table procedure catalog
  2. Use SparkCatalog (the normal Iceberg catalog) for time-travel reads
  3. Complete the rewrite procedure first, then query with time travel via the regular catalog

Example fix

// before
spark.read.option("version-as-of", 5).table("prod.db.events") // via rewrite catalog
// after
spark.sql("CALL prod.system.rewrite_data_files(table => 'db.events')") // no time travel in rewrite catalog
Defensive patterns

Strategy: validation

Validate before calling

require(!queryOptions.contains("version-as-of"), "time travel not supported through rewrite catalog")

Try / catch

try {
  catalog.loadTable(ident, version)
} catch {
  case _: UnsupportedOperationException => loadWithoutTimeTravel(ident)
}

Prevention

When it happens

Trigger: Calling loadTable(ident, version) (or a Spark query with VERSION AS OF / FOR SYSTEM_VERSION AS OF) against a catalog bound to SparkRewriteTableCatalog.

Common situations: Running time-travel queries while a rewrite catalog binding is active; framework code resolving tables with the versioned overload during a rewrite.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/c0ee9aaba9513ca1. Report an issue: GitHub.