apache/hadoop · error · UnsupportedOperationException
getShuffleFinishTime() not supported for MapTask
Error message
getShuffleFinishTime() not supported for MapTask
What it means
MapTaskStatus models only map-phase timing (mapFinishTime); shuffle and sort finish times exist solely on ReduceTaskStatus because maps never shuffle input. Calling getShuffleFinishTime() on a map task's status throws UnsupportedOperationException by design.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/MapTaskStatus.java:59
return true;
}
/**
* Sets finishTime.
* @param finishTime finish time of task.
*/
@Override
void setFinishTime(long finishTime) {
super.setFinishTime(finishTime);
// set mapFinishTime if it hasn't been set before
if (getMapFinishTime() == 0) {
setMapFinishTime(finishTime);
}
}
@Override
public long getShuffleFinishTime() {
throw new UnsupportedOperationException("getShuffleFinishTime() not supported for MapTask");
}
@Override
void setShuffleFinishTime(long shuffleFinishTime) {
throw new UnsupportedOperationException("setShuffleFinishTime() not supported for MapTask");
}
@Override
public long getMapFinishTime() {
return mapFinishTime;
}
@Override
void setMapFinishTime(long mapFinishTime) {
this.mapFinishTime = mapFinishTime;
}
@OverrideView on GitHub (pinned to 2add963021)
Solutions
- Branch on task type first: status.getIsMap() (or instanceof ReduceTaskStatus) before calling shuffle APIs
- Use getMapFinishTime() for maps and getShuffleFinishTime()/getSortFinishTime() only for reduces
- Teach serializers to skip reduce-only getters for map tasks (view/annotation-based exclusion)
Example fix
// before
long phaseEnd = status.getShuffleFinishTime(); // throws for map attempts
// after
long phaseEnd = status.getIsMap()
? status.getMapFinishTime()
: status.getShuffleFinishTime(); Defensive patterns
Strategy: type-guard
Type guard
static boolean hasShuffleFinishTime(TaskStatus s) {
return s != null && !s.getIsMap(); // equivalently: s instanceof ReduceTaskStatus
} Try / catch
if (hasShuffleFinishTime(status)) { shuffleEnd = status.getShuffleFinishTime(); } else { mapEnd = status.getMapFinishTime(); } // guard first; only catch UnsupportedOperationException as a last-resort signal of a type bug Prevention
- Model task phases by task type: map -> mapFinish, reduce -> shuffle/sort/finish
- Never call reduce-only TaskStatus methods from generic code paths
- Write one adapter (getPhaseFinishTime(TaskStatus)) and use it everywhere
When it happens
Trigger: Generic code iterating task reports calls status.getShuffleFinishTime() without checking task type: monitoring/audit dashboards, JSON/JMX serializers that walk all getters, or code ported from paths that only ever saw ReduceTaskStatus.
Common situations: Custom job-history or monitoring tooling reading timings from every task; reflection-based serializers touching reduce-only getters; libraries shared between map and reduce handling paths.
Related errors
- setShuffleFinishTime() not supported for MapTask
- Not implemented by the ${getClass().getSimpleName()} FileSys
- Changing job priority in LocalJobRunner is not supported.
- Killing tasks in LocalJobRunner is not supported
- Not supported
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/9b5a4c909e350a94.
Report an issue: GitHub.