@Override
  public ErrorAndSolution getErrorAndSolution() {
    ErrorAndSolution es = null;

    if(getQueryMatches()) {
      for(List<String> matchingLines : getRegexToLogLines().values()) {
        // There should really only be one line with "Script failed..."
        if (matchingLines.size() > 0) {
          assert(matchingLines.size() == 1);

          // Get "Script failed with code <some number>"
          Matcher m1 = Pattern.compile(FAILED_REGEX).matcher(matchingLines.get(0));
          m1.find();
          String failedStr = m1.group();

          // Get "<some number>"
          Matcher m2 = Pattern.compile("[0-9]+").matcher(failedStr);
          m2.find();
          String errorCode = m2.group();

          es = new ErrorAndSolution(
            "A user-supplied transfrom script has exited with error code " +
            errorCode + " instead of 0.",
            "Verify that the script can properly handle all the input rows " +
            "without throwing exceptions and exits properly.");
        }
      }
    }

    reset();
    return es;
  }
Detects when a query has failed because a user's script that was specified in
transform returns a non-zero error code.

Conditions to check:

1. "Script failed with code &lt;some number&gt;" is in the log
ql/src/java/org/apache/hadoop/hive/ql/exec/errors/ScriptErrorHeuristic.java