apache/iceberg · error · UnsupportedOperationException
AboveMax has no value
Error message
AboveMax has no value
What it means
AboveMax is a sentinel Literal produced when converting a literal that exceeds the maximum representable value of a target type (Literal.to(Type)). It has no concrete value, so calling value() throws UnsupportedOperationException. The sentinel exists so comparisons like 'x > AboveMax' can be recognized as always-false without a real value.
Source
Thrown at api/src/main/java/org/apache/iceberg/expressions/Literals.java:183
ComparableLiteral(C value) {
super(value);
}
@Override
@SuppressWarnings("unchecked")
public Comparator<C> comparator() {
return (Comparator<C>) CMP;
}
}
static class AboveMax<T> implements Literal<T> {
private static final AboveMax INSTANCE = new AboveMax();
private AboveMax() {}
@Override
public T value() {
throw new UnsupportedOperationException("AboveMax has no value");
}
@Override
public <X> Literal<X> to(Type type) {
throw new UnsupportedOperationException("Cannot change the type of AboveMax");
}
@Override
public Comparator<T> comparator() {
throw new UnsupportedOperationException("AboveMax has no comparator");
}
@Override
public String toString() {
return "aboveMax";
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Check for AboveMax/BelowMin (instanceof Literals.AboveMax / Literals.BelowMin) before calling value() and treat them as +/- infinity
- Use the literal's comparator or special-case the comparison instead of extracting a value
- Recompute the literal in a wider type so a concrete value exists
Example fix
// before
Object v = converted.value(); // throws for AboveMax
// after
if (converted instanceof Literals.AboveMax) { return alwaysFalse(); }
Object v = converted.value(); Defensive patterns
Strategy: type-guard
Validate before calling
if (lit instanceof Literals.AboveMax || lit instanceof Literals.BelowMin) {
// handle as +/- infinity; do not call value()
} Type guard
static boolean hasConcreteValue(Literal<?> lit) {
return !(lit instanceof Literals.AboveMax) && !(lit instanceof Literals.BelowMin);
} Try / catch
Object v;
try {
v = lit.value();
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("AboveMax has no value")) {
return treatAsPositiveInfinity();
}
throw e;
} Prevention
- Always instanceof-check for AboveMax/BelowMin after Literal.to(Type) conversions
- Remember any to() can overflow and return a sentinel; extract values only from checked literals
- Use comparator-based or bound logic that treats sentinels as +/- infinity instead of reading values
When it happens
Trigger: Calling value() on the literal returned by Literals.aboveMax() or by literal.to(smallType) where the original value overflowed the target type — e.g. in expression evaluation, bound extraction, or statistics code that assumes every literal has a value.
Common situations: Narrowing a Long literal to Integer or a Double literal to Float where the value exceeds the target range, then attempting to read the value for lower/upper bound computation.
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
- toByteBuffer is not supported
- Cannot change the type of AboveMax
- Cannot create expression literal from %s: %s
- integer overflow
- Can't retrieve values from an empty struct
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/89381b968b57a0b6.
Report an issue: GitHub.