apache/iceberg · error · UnsupportedOperationException

Partition statistics scan is not supported

Error message

Partition statistics scan is not supported

What it means

This UnsupportedOperationException comes from the default implementation of Table.newPartitionStatisticsScan() in the Iceberg API. It signals that the concrete Table implementation does not support scanning partition statistics files. Only certain implementations (e.g. those backed by full metadata such as BaseTable) override this; metadata tables, wrappers, or read-only views leave the default throwing version in place.

Source

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

   *
   * <p>Once a scan is created, it can be refined to project columns and filter data.
   *
   * @return an incremental changelog scan
   */
  default IncrementalChangelogScan newIncrementalChangelogScan() {
    throw new UnsupportedOperationException("Incremental changelog scan is not supported");
  }

  /**
   * Create a new {@link PartitionStatisticsScan} for this table.
   *
   * <p>Once a partition statistics scan is created, it can be refined to project columns and filter
   * data.
   *
   * @return a partition statistics scan for this table
   */
  default PartitionStatisticsScan newPartitionStatisticsScan() {
    throw new UnsupportedOperationException("Partition statistics scan is not supported");
  }

  /**
   * Return the {@link Schema schema} for this table.
   *
   * @return this table's schema
   */
  Schema schema();

  /**
   * Return a map of {@link Schema schema} for this table.
   *
   * @return this table's schema map
   */
  Map<Integer, Schema> schemas();

  /**
   * Return the {@link PartitionSpec partition spec} for this table.

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the concrete Table type before calling; only call newPartitionStatisticsScan() on tables that implement it (e.g. unwrap to the underlying BaseTable).
  2. Upgrade the Iceberg catalog implementation to a version that supports partition statistics scans.
  3. Catch UnsupportedOperationException and skip partition-statistics computation gracefully.
  4. If you wrote a custom Table implementation, override newPartitionStatisticsScan() to return a real PartitionStatisticsScan.

Example fix

// before
PartitionStatisticsScan scan = table.newPartitionStatisticsScan();

// after
PartitionStatisticsScan scan;
try {
  scan = table.newPartitionStatisticsScan();
} catch (UnsupportedOperationException e) {
  scan = null; // table implementation does not expose partition statistics
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling
boolean supported = !(table instanceof MetadataTable) && !table.getClass().getSimpleName().contains("Serializable");
if (!supported) { skipPartitionStats(); }

Type guard

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

Try / catch

try {
  PartitionStatisticsScan scan = table.newPartitionStatisticsScan();
  // use scan
} catch (UnsupportedOperationException e) {
  LOG.warn("Partition statistics scan unsupported for {}", table.name());
}

Prevention

When it happens

Trigger: Calling table.newPartitionStatisticsScan() on a Table implementation that does not override the method — e.g. a metadata table (Table), a wrapped/custom Table, or a StaticTable-like implementation. Raised directly from the default method body at Table.java:95.

Common situations: Running maintenance or analysis jobs (e.g. computeAndMergeStatsIncremental) against tables obtained through catalogs or wrappers that don't implement partition stats; using metadata tables as if they were normal tables; custom Catalog implementations returning partially-implemented Table objects.

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