FAQ
Repository: hive
Updated Branches:
   refs/heads/master 413645d1b -> 37db169a8


HIVE-13559: Pass exception to failure hooks (Jimmy Xiang, reviewed by Chaoyu Tang)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/37db169a
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/37db169a
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/37db169a

Branch: refs/heads/master
Commit: 37db169a844ad1217abcde67b1350d7064d2c005
Parents: 413645d
Author: Jimmy Xiang <jxiang@apache.org>
Authored: Wed Apr 20 11:43:22 2016 -0700
Committer: Jimmy Xiang <jxiang@apache.org>
Committed: Mon Apr 25 07:33:54 2016 -0700

----------------------------------------------------------------------
  ql/src/java/org/apache/hadoop/hive/ql/Driver.java | 9 +++++----
  .../java/org/apache/hadoop/hive/ql/hooks/HookContext.java | 9 +++++++++
  2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/37db169a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
index 48fb060..9aefff8 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
@@ -1641,7 +1641,7 @@ public class Driver implements CommandProcessor {

            } else {
              setErrorMsgAndDetail(exitVal, result.getTaskError(), tsk);
- invokeFailureHooks(perfLogger, hookContext);
+ invokeFailureHooks(perfLogger, hookContext, result.getTaskError());
              SQLState = "08S01";
              console.printError(errorMessage);
              driverCxt.shutdown();
@@ -1677,7 +1677,7 @@ public class Driver implements CommandProcessor {
        if (driverCxt.isShutdown()) {
          SQLState = "HY008";
          errorMessage = "FAILED: Operation cancelled";
- invokeFailureHooks(perfLogger, hookContext);
+ invokeFailureHooks(perfLogger, hookContext, null);
          console.printError(errorMessage);
          return 1000;
        }
@@ -1734,7 +1734,7 @@ public class Driver implements CommandProcessor {
        errorMessage = "FAILED: Hive Internal Error: " + Utilities.getNameMessage(e);
        if (hookContext != null) {
          try {
- invokeFailureHooks(perfLogger, hookContext);
+ invokeFailureHooks(perfLogger, hookContext, e);
          } catch (Exception t) {
            LOG.warn("Failed to invoke failure hook", t);
          }
@@ -1813,9 +1813,10 @@ public class Driver implements CommandProcessor {
      }
    }

- private void invokeFailureHooks(PerfLogger perfLogger, HookContext hookContext) throws Exception {
+ private void invokeFailureHooks(PerfLogger perfLogger, HookContext hookContext, Throwable exception) throws Exception {
      hookContext.setHookType(HookContext.HookType.ON_FAILURE_HOOK);
      hookContext.setErrorMessage(errorMessage);
+ hookContext.setException(exception);
      // Get all the failure execution hooks and execute them.
      for (Hook ofh : getHooks(HiveConf.ConfVars.ONFAILUREHOOKS)) {
        perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.FAILURE_HOOK + ofh.getClass().getName());

http://git-wip-us.apache.org/repos/asf/hive/blob/37db169a/ql/src/java/org/apache/hadoop/hive/ql/hooks/HookContext.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/hooks/HookContext.java b/ql/src/java/org/apache/hadoop/hive/ql/hooks/HookContext.java
index 6fd1f66..8e1672f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/hooks/HookContext.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/hooks/HookContext.java
@@ -52,6 +52,7 @@ public class HookContext {
    private UserGroupInformation ugi;
    private HookType hookType;
    private String errorMessage;
+ private Throwable exception;
    final private Map<String, ContentSummary> inputPathToContentSummary;
    private final String ipAddress;
    private final String userName;
@@ -172,6 +173,14 @@ public class HookContext {
      return errorMessage;
    }

+ public void setException(Throwable exception) {
+ this.exception = exception;
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+
    public String getOperationName() {
      return queryPlan.getOperationName();
    }

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedApr 25, '16 at 2:58p
activeApr 25, '16 at 2:58p
posts1
users1
websitehive.apache.org

1 user in discussion

Jxiang: 1 post

People

Translate

site design / logo © 2021 Grokbase