apache/iceberg · error · UnsupportedOperationException

Updating partition statistics is not supported by + getClass

Error message

Updating partition statistics is not supported by + getClass().getName()

What it means

The default Table.updatePartitionStatistics() implementation throws UnsupportedOperationException because the concrete Table implementation cannot add or remove partition statistics files. Like the table-statistics variant, it names the class that lacks support; implementations must override it to support partition statistics writes.

Source

Thrown at api/src/main/java/org/apache/iceberg/Table.java:309

  /**
   * Create a new {@link UpdateStatistics update table statistics API} to add or remove statistics
   * files in this table.
   *
   * @return a new {@link UpdateStatistics}
   */
  default UpdateStatistics updateStatistics() {
    throw new UnsupportedOperationException(
        "Updating statistics is not supported by " + getClass().getName());
  }

  /**
   * Create a new {@link UpdatePartitionStatistics update partition statistics API} to add or remove
   * partition statistics files in this table.
   *
   * @return a new {@link UpdatePartitionStatistics}
   */
  default UpdatePartitionStatistics updatePartitionStatistics() {
    throw new UnsupportedOperationException(
        "Updating partition statistics is not supported by " + getClass().getName());
  }

  /**
   * Create a new {@link ExpireSnapshots expire API} to expire snapshots in this table and commit.
   *
   * @return a new {@link ExpireSnapshots}
   */
  ExpireSnapshots expireSnapshots();

  /**
   * Create a new {@link ManageSnapshots manage snapshots API} to manage snapshots in this table and
   * commit.
   *
   * @return a new {@link ManageSnapshots}
   */
  ManageSnapshots manageSnapshots();

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Use the underlying BaseTable implementation rather than a metadata table or wrapper.
  2. Upgrade the catalog/table implementation to one supporting partition statistics.
  3. Catch UnsupportedOperationException and skip partition statistics updates.
  4. Override updatePartitionStatistics() in custom Table implementations.

Example fix

// before
table.updatePartitionStatistics().addPartitionStatisticsFile(file).commit();

// after
try {
  table.updatePartitionStatistics().addPartitionStatisticsFile(file).commit();
} catch (UnsupportedOperationException e) {
  LOG.warn("Partition statistics not supported for {}", table.name());
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify support before staging partition statistics
if (!table.implersions().isEmpty()) { /* placeholder */ }
try { table.updatePartitionStatistics(); } catch (UnsupportedOperationException e) { skip(); }

Type guard

boolean supportsPartitionStatsUpdate(Table t) {
  try { t.updatePartitionStatistics(); return true; }
  catch (UnsupportedOperationException e) { return false; }
}

Try / catch

try {
  table.updatePartitionStatistics().addPartitionStatisticsFile(f).commit();
} catch (UnsupportedOperationException e) {
  LOG.warn("Partition statistics update unsupported for {}", table.name());
}

Prevention

When it happens

Trigger: Calling table.updatePartitionStatistics() on an implementation that does not override the default — metadata tables, custom Table wrappers, or catalogs without partition statistics support. Also hit via test helpers building partition statistics (e.g. tableWithTwoPartitions-style fixtures) against such tables.

Common situations: Running partition-stats maintenance (projecting stat fields, v2-to-v3 schema evolution tests) on tables from catalogs that predate partition statistics support; using wrapped tables that forward reads but not stats writes.

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/31813309109819aa. Report an issue: GitHub.