apache/iceberg · error · UnsupportedOperationException
retailAll is not supported
Error message
retailAll is not supported
What it means
StructLikeSet.retainAll is not implemented; the set throws UnsupportedOperationException with a message containing a typo ('retailAll'). Any attempt to keep only the elements present in the given collection fails immediately.
Solutions
- Build the intersection manually: iterate the set, remove elements not in the other collection (set.removeIf(o -> !objects.contains(o)))
- Create a new StructLikeSet containing only elements present in both sets
- Use StructLikeSet.create(spec/type) plus a loop with contains() checks
Example fix
// before set.retainAll(keepKeys); // after set.removeIf(key -> !keepKeys.contains(key));
Defensive patterns
Strategy: fallback
Prevention
- Avoid retainAll on StructLikeSet; use removeIf or manual intersection
- Check the Set implementation before calling bulk mutation methods
- Build a plain HashSet if full Collection mutation semantics are needed
- Note the typo'd message ('retailAll') when grepping logs
When it happens
Trigger: Calling set.retainAll(otherCollection) on a StructLikeSet to intersect it in place.
Common situations: Set-intersection logic ported from HashSet-based code; deduplicating rows by keeping only known keys.
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
- 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
- Altering a view is not supported by catalog: catalogName
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/da1d3bfec12d50a5.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/apache/iceberg/util/StructLikeSet.java:135
public boolean containsAll(Collection<?> objects) {
if (objects != null) {
return Iterables.all(objects, this::contains);
}
return false;
}
@Override
public boolean addAll(Collection<? extends StructLike> structs) {
if (structs != null) {
return Iterables.addAll(
wrapperSet, Iterables.transform(structs, struct -> wrappers.get().copyFor(struct)));
}
return false;
}
@Override
public boolean retainAll(Collection<?> objects) {
throw new UnsupportedOperationException("retailAll is not supported");
}
@Override
public boolean removeAll(Collection<?> objects) {
boolean changed = false;
if (objects != null) {
for (Object object : objects) {
changed |= remove(object);
}
}
return changed;
}
@Override
public void clear() {
wrapperSet.clear();
}
View on GitHub (pinned to 86d9c8fc54)