apache/hadoop · error · UnsupportedOperationException
getMapFinishTime() not supported for ReduceTask
Error message
getMapFinishTime() not supported for ReduceTask
What it means
ReduceTaskStatus tracks shuffle-finish, sort-finish, and finish times for reduce attempts; a map finish time simply does not exist for reduces. The override of getMapFinishTime() therefore always throws UnsupportedOperationException, mirroring setMapFinishTime(). Code that walks mixed TaskStatus objects and unconditionally reads map timings will blow up on every reduce status.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/ReduceTaskStatus.java:92
this.shuffleFinishTime = shuffleFinishTime;
}
@Override
public long getSortFinishTime() {
return sortFinishTime;
}
@Override
void setSortFinishTime(long sortFinishTime) {
this.sortFinishTime = sortFinishTime;
if (0 == this.shuffleFinishTime){
this.shuffleFinishTime = sortFinishTime;
}
}
@Override
public long getMapFinishTime() {
throw new UnsupportedOperationException(
"getMapFinishTime() not supported for ReduceTask");
}
@Override
void setMapFinishTime(long shuffleFinishTime) {
throw new UnsupportedOperationException(
"setMapFinishTime() not supported for ReduceTask");
}
@Override
public List<TaskAttemptID> getFetchFailedMaps() {
return failedFetchTasks;
}
@Override
public void addFetchFailedMap(TaskAttemptID mapTaskId) {
failedFetchTasks.add(mapTaskId);
}View on GitHub (pinned to 2add963021)
Solutions
- Branch on status.getIsMap() before calling getMapFinishTime().
- For reduce tasks use getShuffleFinishTime(), getSortFinishTime(), and getFinishTime() instead.
- Search the codebase for getMapFinishTime() call sites that run inside loops over all task statuses and guard each one.
Example fix
// before long mapDone = status.getMapFinishTime(); // after long mapDone = status.getIsMap() ? status.getMapFinishTime() : -1L;
Defensive patterns
Strategy: type-guard
Type guard
static boolean hasMapFinishTime(TaskStatus s) {
return s != null && s.getIsMap();
} Prevention
- Branch on TaskStatus.getIsMap() before touching map-only fields.
- For reduces, expose shuffle/sort/finish times instead of a map finish time.
- In shared monitoring code, wrap status field reads behind accessors that check task type.
When it happens
Trigger: Calling status.getMapFinishTime() on a TaskStatus whose getIsMap() is false, e.g. generic task-duration tooling, JMX/history serializers, or monitoring code shared between map and reduce paths.
Common situations: Job-history analyzers and dashboards that assume all task statuses expose map finish time; code copied from map-side diagnostics into a reduce path.
Related errors
- setMapFinishTime() not supported for ReduceTask
- Input only available on map
- not implemented
- Changing job priority in LocalJobRunner is not supported.
- Killing tasks in LocalJobRunner is not supported
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/9a4f369ae0d973e4.
Report an issue: GitHub.