apache/iceberg · error · UnsupportedOperationException

%s does not implement removeRows

Error message

%s does not implement removeRows

What it means

RowDelta.removeRows(DataFile) is a default method on the RowDelta API for removing data files within a row-delta commit; the default throws UnsupportedOperationException when an implementation does not override it. It documents that removing rows/data files via RowDelta is optional for implementations, and the instance in use does not support it.

Source

Thrown at api/src/main/java/org/apache/iceberg/RowDelta.java:56

   */
  RowDelta addRows(DataFile inserts);

  /**
   * Add a {@link DeleteFile} to the table.
   *
   * @param deletes a delete file of rows to delete
   * @return this for method chaining
   */
  RowDelta addDeletes(DeleteFile deletes);

  /**
   * Remove a {@link DataFile} from the table.
   *
   * @param file a data file
   * @return this for method chaining
   */
  default RowDelta removeRows(DataFile file) {
    throw new UnsupportedOperationException(
        getClass().getName() + " does not implement removeRows");
  }

  /**
   * Removes a rewritten {@link DeleteFile} from the table.
   *
   * @param deletes a delete file that can be removed from the table
   * @return this for method chaining
   */
  default RowDelta removeDeletes(DeleteFile deletes) {
    throw new UnsupportedOperationException(
        getClass().getName() + " does not implement removeDeletes");
  }

  /**
   * Set the snapshot ID used in any reads for this operation.
   *
   * <p>Validations will check changes after this snapshot ID. If the from snapshot is not set, all

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Upgrade iceberg-core to a version whose BaseRowDelta overrides removeRows(DataFile).
  2. Use RewriteFiles.deleteFile(DataFile) instead if the goal is a file rewrite rather than a row-delta commit.
  3. If you implement RowDelta, override removeRows(DataFile) to record the data file for removal.

Example fix

// before
RowDelta delta = table.newRowDelta();
delta.removeRows(dataFile); // impl throws
// after
RewriteFiles rewrite = table.newRewrite(); // removeRows equivalent for rewrites
rewrite.deleteFile(dataFile);
Defensive patterns

Strategy: fallback

Validate before calling

static boolean supportsRemoveRows(RowDelta delta) { return delta instanceof BaseRowDelta; }

Type guard

boolean canRemoveRows = rowDelta instanceof org.apache.iceberg.BaseRowDelta;

Try / catch

try {
  delta.removeRows(dataFile);
} catch (UnsupportedOperationException e) {
  throw new IllegalStateException("Use RewriteFiles.deleteFile for rewrites; this RowDelta lacks removeRows", e);
}

Prevention

When it happens

Trigger: Invoking removeRows(DataFile) on a RowDelta obtained from an implementation that only supports addRows/addDeletes/removeDeletes — typically a custom BaseRowDelta or an older core version predating this method.

Common situations: Mixed api/core versions where the core RowDelta implementation predates removeRows; custom table implementations or test doubles; third-party catalogs returning their own RowDelta.

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/1615132c831c3325. Report an issue: GitHub.