apache/iceberg · error · UnsupportedOperationException
Histogram is not supported.
Error message
Histogram is not supported.
What it means
MetricsContext.histogram(String) is a default stub throwing UnsupportedOperationException('Histogram is not supported.'). The base interface offers no histogram support by default; implementations must override it to provide one.
Source
Thrown at api/src/main/java/org/apache/iceberg/metrics/MetricsContext.java:153
* @return a {@link org.apache.iceberg.metrics.Counter} implementation
*/
default org.apache.iceberg.metrics.Counter counter(String name) {
return counter(name, Unit.COUNT);
}
/**
* Get a named timer.
*
* @param name name of the metric
* @param unit the time unit designation of the metric
* @return a timer implementation
*/
default Timer timer(String name, TimeUnit unit) {
throw new UnsupportedOperationException("Timer is not supported.");
}
default Histogram histogram(String name) {
throw new UnsupportedOperationException("Histogram is not supported.");
}
/**
* Utility method for producing no metrics.
*
* @return a non-recording metrics context
*/
static MetricsContext nullMetrics() {
return new MetricsContext() {
@Override
public Timer timer(String name, TimeUnit unit) {
return Timer.NOOP;
}
@Override
@SuppressWarnings("unchecked")
public <T extends Number> Counter<T> counter(String name, Class<T> type, Unit unit) {View on GitHub (pinned to 86d9c8fc54)
Solutions
- Use a MetricsContext implementation that overrides histogram()
- Override histogram(String) in your custom context
- If histograms aren't needed, avoid calling this method or return a NOOP histogram
- Feature-check before requesting a histogram
Example fix
// before
Histogram h = ctx.histogram("distribution"); // throws
// after
Histogram h = supportedContext.histogram("distribution"); Defensive patterns
Strategy: fallback
Try / catch
try { histogram } catch (UnsupportedOperationException e) { skip } Prevention
- Override histogram() where needed
- Capability-check before use
When it happens
Trigger: Calling histogram(name) on a MetricsContext that doesn't override it, then recording values into the histogram.
Common situations: Custom MetricsContext implementations lacking histogram support; code assuming all contexts (including minimal test contexts) provide histograms.
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
- NOOP counter has no value
- Count is not supported.
- Counter is not supported.
- Timer is not supported.
- NOOP timer has no count
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/954147433b150c08.
Report an issue: GitHub.