apache/hadoop · error · UnsupportedOperationException
remove not supported.
Error message
remove not supported.
What it means
SortedRanges.SkipRangeIterator walks the ranges of indices to skip; it is a read-only cursor over skip ranges, so mutation is meaningless and remove() always throws UnsupportedOperationException. The iterator is used inside skipping record readers, far from normal Collection iteration.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/SortedRanges.java:379
next = range.getEndIndex();
}
}
/**
* Get whether all the ranges have been skipped.
* @return <code>true</code> if all ranges have been skipped.
* <code>false</code> otherwise.
*/
synchronized boolean skippedAllRanges() {
return !rangeIterator.hasNext() && next>range.getEndIndex();
}
/**
* Remove is not supported. Doesn't apply.
*/
public void remove() {
throw new UnsupportedOperationException("remove not supported.");
}
}
}
View on GitHub (pinned to 2add963021)
Solutions
- Remove the remove() call — skip ranges are advanced only via next()/hasNext().
- If removal semantics are needed, materialize the indices into your own collection first and mutate that copy.
Example fix
// before it.next(); it.remove(); // after it.next(); // advance only; removal is not supported
Defensive patterns
Strategy: validation
Validate before calling
// never call remove() on SkipRangeIterator; advance only
while (skipIt.hasNext()) { long idx = skipIt.next(); /* use idx */ } Prevention
- Treat framework iterators as read-only cursors.
- When passing iterators into generic utilities, wrap them in an unmodifiable adapter.
- Read the iterator's contract before calling optional operations like remove().
When it happens
Trigger: Calling iterator.remove() on the SkipRangeIterator obtained from SortedRanges.skipRangeIterator(), typically from generic collection plumbing or a custom reader that treats every Iterator as removable.
Common situations: Utility methods written against java.util.Iterator that defensively call remove(); porting a reader that previously used a mutable ArrayList iterator.
Related errors
- not implemented
- Changing job priority in LocalJobRunner is not supported.
- Killing tasks in LocalJobRunner is not supported
- Not supported
- getShuffleFinishTime() not supported for MapTask
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/549d5f3cdab55070.
Report an issue: GitHub.