diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java index ab0635e..8fcbab8 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java @@ -21,6 +21,9 @@ import java.util.ArrayList; import com.google.common.collect.Lists; import com.google.common.collect.Sets; + +import sun.tools.java.ClassNotFound; + import java.beans.DefaultPersistenceDelegate; import java.beans.Encoder; import java.beans.Expression; @@ -194,6 +197,7 @@ import org.slf4j.LoggerFactory; import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.KryoException; import com.google.common.base.Preconditions; /** @@ -445,6 +449,16 @@ private static BaseWork getBaseWork(Configuration conf, String name) { LOG.debug("File not found: " + fnf.getMessage()); LOG.info("No plan file found: "+path); return null; + } catch (KryoException ke) { + Throwable cnfThrowable = findClassNotFoundException(ke); + if (HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_EXECUTION_MODE).equals("llap") + && (cnfThrowable != null)) { + LOG.error("Class not found. You need to regenerate the llap startup script and restart " + + "llap with jars for your udf.", cnfThrowable); + throw new RuntimeException("You need to regenerate the LLAP startup script and restart" + + " llap daemons.", cnfThrowable); + } + throw new RuntimeException(ke); } catch (Exception e) { String msg = "Failed to load plan: " + path + ": " + e; LOG.error(msg, e); @@ -459,6 +473,17 @@ private static BaseWork getBaseWork(Configuration conf, String name) { } } + private static Throwable findClassNotFoundException(Throwable ke) { + while (ke.getCause() != null) { + if (ke.getCause() instanceof ClassNotFoundException) { + return ke.getCause(); + } else { + return findClassNotFoundException(ke.getCause()); + } + } + return null; + } + public static void setWorkflowAdjacencies(Configuration conf, QueryPlan plan) { try { Graph stageGraph = plan.getQueryPlan().getStageGraph(); diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java index c560f37..a33b6e2 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java @@ -39,6 +39,7 @@ import org.apache.tez.runtime.api.LogicalInput; import org.apache.tez.runtime.api.LogicalOutput; import org.apache.tez.runtime.api.ProcessorContext; +import org.apache.tez.runtime.api.TaskFailureType; import org.apache.tez.runtime.library.api.KeyValueWriter; /** @@ -178,6 +179,8 @@ protected void initializeAndRunProcessor(Map inputs, } finally { if (originalThrowable != null && originalThrowable instanceof Error) { LOG.error(StringUtils.stringifyException(originalThrowable)); + getContext().reportFailure(TaskFailureType.FATAL, originalThrowable, + "Cannot recover from this error"); throw new RuntimeException(originalThrowable); }