apache/hadoop · error · UnsupportedOperationException

NULL reporter has no input

Error message

NULL reporter has no input

What it means

Reporter.NULL is a stateless no-op singleton used where no real Reporter exists (tests, utility code, wrapped jobs): its counter methods return null or do nothing. Its getInputSplit() deliberately throws UnsupportedOperationException because a NULL reporter has no task input associated with it. Any code path that reaches getInputSplit() through Reporter.NULL is a programming error.

Source

Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Reporter.java:65

   * A constant of Reporter type that does nothing.
   */
  public static final Reporter NULL = new Reporter() {
      public void setStatus(String s) {
      }
      public void progress() {
      }
      public Counter getCounter(Enum<?> name) {
        return null;
      }
      public Counter getCounter(String group, String name) {
        return null;
      }
      public void incrCounter(Enum<?> key, long amount) {
      }
      public void incrCounter(String group, String counter, long amount) {
      }
      public InputSplit getInputSplit() throws UnsupportedOperationException {
        throw new UnsupportedOperationException("NULL reporter has no input");
      }
      @Override
      public float getProgress() {
        return 0;
      }
    };

  /**
   * Set the status description for the task.
   * 
   * @param status brief description of the current status.
   */
  public abstract void setStatus(String status);
  
  /**
   * Get the {@link Counter} of the given group with the given name.
   * 
   * @param name counter name

View on GitHub (pinned to 2add963021)

Solutions

  1. Only call getInputSplit() on the live Reporter instance passed into map() by the framework.
  2. Pass the split explicitly (constructor or configuration) to helpers that need it, instead of extracting it from the reporter.
  3. In the new API use Mapper.Context.getInputSplit() inside map(), which is always populated for map tasks.

Example fix

// before
FileSplit fs = (FileSplit) reporter.getInputSplit(); // reporter may be Reporter.NULL

// after
if (reporter != null && reporter != Reporter.NULL) {
  FileSplit fs = (FileSplit) reporter.getInputSplit();
} else {
  // obtain split from job configuration or context instead
}
Defensive patterns

Strategy: type-guard

Type guard

static boolean reporterHasInputSplit(Reporter r) {
  return r != null && r != Reporter.NULL;
}

Prevention

When it happens

Trigger: Calling Reporter.NULL.getInputSplit(); passing Reporter.NULL into library code that later asks for the split; unit tests exercising old-API map/reduce methods with Reporter.NULL where the code under test calls reporter.getInputSplit().

Common situations: Mappers written against the old API that fetch the FileSplit for the input path, executed in unit tests or reduce-side wrappers where Reporter.NULL was supplied; helper utilities that accept a Reporter for progress but also try to read the split.

Related errors


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