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

  1. Branch on status.getIsMap() before calling getMapFinishTime().
  2. For reduce tasks use getShuffleFinishTime(), getSortFinishTime(), and getFinishTime() instead.
  3. 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

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


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/9a4f369ae0d973e4. Report an issue: GitHub.