diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/session/SparkSessionImpl.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/session/SparkSessionImpl.java index 6e37d93f67..c0b0c82ccd 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/session/SparkSessionImpl.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/session/SparkSessionImpl.java @@ -214,19 +214,13 @@ HiveException getHiveException(Throwable e) { return new HiveException(e, ErrorMsg.SPARK_CREATE_CLIENT_INVALID_RESOURCE_REQUEST, sessionId, matchedString.toString()); } else { - return new HiveException(e, ErrorMsg.SPARK_CREATE_CLIENT_ERROR, sessionId, - getRootCause(oe)); + return new HiveException(e, ErrorMsg.SPARK_CREATE_CLIENT_ERROR, sessionId, Throwables.getRootCause(e).toString()); } } e = e.getCause(); } - return new HiveException(oe, ErrorMsg.SPARK_CREATE_CLIENT_ERROR, sessionId, getRootCause(oe)); - } - - private String getRootCause(Throwable e) { - Throwable rootCause = Throwables.getRootCause(e); - return rootCause.getClass().getName() + ": " + rootCause.getMessage(); + return new HiveException(oe, ErrorMsg.SPARK_CREATE_CLIENT_ERROR, sessionId, Throwables.getRootCause(oe).toString()); } private boolean matches(String input, String regex, StringBuilder matchedString) { diff --git a/ql/src/test/org/apache/hadoop/hive/ql/exec/spark/session/TestSparkSessionManagerImpl.java b/ql/src/test/org/apache/hadoop/hive/ql/exec/spark/session/TestSparkSessionManagerImpl.java index 15756da186..939966ee36 100644 --- a/ql/src/test/org/apache/hadoop/hive/ql/exec/spark/session/TestSparkSessionManagerImpl.java +++ b/ql/src/test/org/apache/hadoop/hive/ql/exec/spark/session/TestSparkSessionManagerImpl.java @@ -180,8 +180,8 @@ public void testGetHiveException() throws Exception { "initial executor number 5 must between min executor number10 and max executor number 50"); // Other exceptions which defaults to SPARK_CREATE_CLIENT_ERROR - e = new Exception("Other exception"); - checkHiveException(ss, e, ErrorMsg.SPARK_CREATE_CLIENT_ERROR, "Other exception"); + e = new java.lang.NoClassDefFoundError("org/apache/spark/SparkConf"); + checkHiveException(ss, e, ErrorMsg.SPARK_CREATE_CLIENT_ERROR, "java.lang.NoClassDefFoundError: org/apache/spark/SparkConf"); } private void checkHiveException(SparkSessionImpl ss, Throwable e, ErrorMsg expectedErrMsg) {