public void run(HookContext hookContext) {
    LogHelper console = SessionState.getConsole();

    for (Entry<String, List<String>> entry : SessionState.get().getLocalMapRedErrors().entrySet()) {
      console.printError("ID: " + entry.getKey());

      for (String line : entry.getValue()) {
        console.printError(line);
      }
    }
  }
VerifySessionStateLocalErrorsHook.

This hook is intended for testing that the localMapRedErrors variable in SessionState is
populated when a local map reduce job fails.  It prints the ID of the stage that failed, and
the lines recorded in the variable.
itests/util/src/main/java/org/apache/hadoop/hive/ql/hooks/VerifySessionStateLocalErrorsHook.java