apache/iceberg · error · UnsupportedOperationException

%s does not implement dataSequenceNumber

Error message

%s does not implement dataSequenceNumber

What it means

RewriteFiles.dataSequenceNumber(long) is a default interface method that sets the data sequence number applied to all files added by the rewrite, used to avoid commit conflicts between compaction and concurrent equality deletes. The default throws UnsupportedOperationException, signaling the implementation does not support explicit sequence-number assignment.

Source

Thrown at api/src/main/java/org/apache/iceberg/RewriteFiles.java:129

   * @param deleteFile a new delete file
   * @param dataSequenceNumber data sequence number to append on the file
   * @return this for method chaining
   */
  default RewriteFiles addFile(DeleteFile deleteFile, long dataSequenceNumber) {
    throw new UnsupportedOperationException(
        this.getClass().getName() + " does not implement addFile");
  }

  /**
   * Configure the data sequence number for this rewrite operation. This data sequence number will
   * be used for all new data files that are added in this rewrite. This method is helpful to avoid
   * commit conflicts between data compaction and adding equality deletes.
   *
   * @param sequenceNumber a data sequence number
   * @return this for method chaining
   */
  default RewriteFiles dataSequenceNumber(long sequenceNumber) {
    throw new UnsupportedOperationException(
        this.getClass().getName() + " does not implement dataSequenceNumber");
  }

  /**
   * Add a rewrite that replaces one set of data files with another set that contains the same data.
   *
   * @param filesToDelete files that will be replaced (deleted), cannot be null or empty.
   * @param filesToAdd files that will be added, cannot be null or empty.
   * @return this for method chaining
   * @deprecated since 1.3.0, will be removed in 2.0.0
   */
  @Deprecated
  default RewriteFiles rewriteFiles(Set<DataFile> filesToDelete, Set<DataFile> filesToAdd) {
    return rewriteFiles(filesToDelete, ImmutableSet.of(), filesToAdd, ImmutableSet.of());
  }

  /**
   * Add a rewrite that replaces one set of data files with another set that contains the same data.

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade iceberg-core so BaseRewriteFiles overrides dataSequenceNumber(long).
  2. If not needed, drop the call and let the operation derive the sequence number from the current snapshot.
  3. In custom implementations, override dataSequenceNumber(long) to store the sequence number used for added files.

Example fix

// before
RewriteFiles rewrite = new OldRewriteFiles();
rewrite.dataSequenceNumber(seq); // UnsupportedOperationException
// after
RewriteFiles rewrite = table.newRewrite(); // standard impl
rewrite.dataSequenceNumber(seq);
Defensive patterns

Strategy: try-catch

Validate before calling

Preconditions.checkArgument(rewrite.getClass().getName().startsWith("org.apache.iceberg."), "dataSequenceNumber requires the stock BaseRewriteFiles");

Type guard

static boolean supportsDataSequenceNumber(RewriteFiles rf) { return rf instanceof BaseRewriteFiles; }

Try / catch

try {
  rewrite.dataSequenceNumber(seq);
} catch (UnsupportedOperationException e) {
  LOG.warn("RewriteFiles impl does not support explicit data sequence number; skipping", e);
}

Prevention

When it happens

Trigger: Calling dataSequenceNumber(long) on a RewriteFiles implementation that does not override it — e.g. doReplace/commitFileGroups paths running against a custom or outdated RewriteFiles.

Common situations: Iceberg runtimes predating the sequence-number rewrite feature (added to prevent conflicts with equality-delete writers); custom table operation implementations in tests or third-party catalogs.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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