apache/iceberg · error · UnsupportedOperationException
Does not support setValue.
Error message
Does not support setValue.
What it means
StructLikeMap exposes its entries as Map.Entry views backed by the key's StructLike wrapper. The entry's setValue is intentionally unsupported because values are stored in an internal wrapper map; mutating through the entry view would bypass the map's invariants, so it always throws UnsupportedOperationException.
Solutions
- Replace entry.setValue(v) with map.put(entry.getKey(), v)
- Use StructLikeMap.transformValues(func) for bulk value transformation
- Rebuild the map into a plain Map if entry mutation semantics are required
Example fix
// before
for (Map.Entry<Record, String> e : map.entrySet()) {
e.setValue(e.getValue().toUpperCase(Locale.ROOT));
}
// after
StructLikeMap<String> updated = map.transformValues(v -> v.toUpperCase(Locale.ROOT)); Defensive patterns
Strategy: fallback
Prevention
- Never call setValue on entries from StructLikeMap.entrySet()
- Use map.put(key, value) for updates
- Use transformValues for bulk value changes
- Remember StructLikeMap entries are read-only views
When it happens
Trigger: Iterating a StructLikeMap's entrySet() and calling entry.setValue(newValue) to update a mapping in place.
Common situations: Refactoring code from HashMap to StructLikeMap where an in-place entry mutation loop existed; bulk value updates during iteration.
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
- Cannot set value
- Altering a view is not supported by catalog:
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/e3a1f333d9be70ef.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/apache/iceberg/util/StructLikeMap.java:190
public int hashCode() {
return inner.hashCode();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
} else if (o == null || getClass() != o.getClass()) {
return false;
}
StructLikeEntry<?> that = (StructLikeEntry<?>) o;
return inner.equals(that.inner);
}
@Override
public R setValue(R value) {
throw new UnsupportedOperationException("Does not support setValue.");
}
}
public <U> StructLikeMap<U> transformValues(Function<T, U> func) {
StructLikeMap<U> result = create(type);
wrapperMap.forEach((key, value) -> result.put(key.get(), func.apply(value)));
return result;
}
}
View on GitHub (pinned to 86d9c8fc54)