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 Transaction.updatePartitionStatistics() throws UnsupportedOperationException because not every Transaction implementation can stage partition-statistics file changes. Implementations must override it to support adding or removing partition statistics files within a transaction; the message names the class that does not.
Source
Thrown at api/src/main/java/org/apache/iceberg/Transaction.java:158
/**
* 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.
*
* @return a new {@link ExpireSnapshots}
*/
ExpireSnapshots expireSnapshots();
/**
* Create a new {@link ManageSnapshots manage snapshot API} to manage snapshots in this table.
*
* @return a new {@link ManageSnapshots}
*/
default ManageSnapshots manageSnapshots() {
throw new UnsupportedOperationException(
"Managing snapshots is not supported by " + getClass().getName());View on GitHub (pinned to 86d9c8fc54)
Solutions
- Apply partition statistics updates directly via table.updatePartitionStatistics() instead of through the transaction.
- Obtain the transaction from the real BaseTable so it overrides updatePartitionStatistics().
- Catch UnsupportedOperationException and fall back to a standalone statistics commit.
- Override updatePartitionStatistics() in custom Transaction implementations.
Example fix
// before
Transaction txn = table.newTransaction();
txn.updatePartitionStatistics().addPartitionStatisticsFile(file).commit();
txn.commitTransaction();
// after
try {
Transaction txn = table.newTransaction();
txn.updatePartitionStatistics().addPartitionStatisticsFile(file).commit();
txn.commitTransaction();
} catch (UnsupportedOperationException e) {
table.updatePartitionStatistics().addPartitionStatisticsFile(file).commit();
} Defensive patterns
Strategy: fallback
Validate before calling
// probe support before staging partition statistics in the txn
try {
txn.updatePartitionStatistics();
} catch (UnsupportedOperationException e) {
useDirectPartitionStatsUpdate(table);
} Type guard
boolean txnSupportsPartitionStats(Transaction txn) {
try { txn.updatePartitionStatistics(); return true; }
catch (UnsupportedOperationException e) { return false; }
} Try / catch
try {
txn.updatePartitionStatistics().addPartitionStatisticsFile(f).commit();
} catch (UnsupportedOperationException e) {
table.updatePartitionStatistics().addPartitionStatisticsFile(f).commit();
} Prevention
- Fall back to table.updatePartitionStatistics() when the transaction cannot stage partition stats
- Verify the table implementation supports partition statistics before wrapping work in a transaction
- Add partition-stats transaction tests to any custom Transaction implementation's suite
When it happens
Trigger: Calling transaction.updatePartitionStatistics() (e.g. commitPartitionStatsTxn / removePartitionStatsTxn flows) on a Transaction implementation that keeps the throwing default — transactions on tables/wrappers without partition statistics support.
Common situations: Atomically committing partition statistics alongside other metadata operations; tests or maintenance jobs applying partition stats through a generic transaction object rather than the table directly.
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
- Partition statistics scan is not supported
- Updating partition statistics is not supported by + getClass
- Updating statistics is not supported by + getClass().getName
- Managing snapshots is not supported by + getClass().getName(
- Cannot call refresh on temporary table operations
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/d48a8a1bd63d43dd.
Report an issue: GitHub.