Skip to content

Commit

Permalink
[KYUUBI-164]display root casue of statement failure on client size (#165
Browse files Browse the repository at this point in the history
)

* [KYUUBI-164]display root casue of statement failure on client size

* fix ut

* fix ut
  • Loading branch information
yaooqinn committed Mar 12, 2019
1 parent 0ab29e5 commit 56fa56a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,25 +387,28 @@ class KyuubiOperation(session: KyuubiSession, statement: String) extends Logging
}
case e: ParseException =>
if (!isClosedOrCanceled) {
onStatementError(
statementId, e.withCommand(statement).getMessage, KyuubiSparkUtil.exceptionString(e))
val err = KyuubiSparkUtil.exceptionString(e)
onStatementError(statementId, e.withCommand(statement).getMessage, err)
throw new KyuubiSQLException(
e.withCommand(statement).getMessage, "ParseException", 2000, e)
e.withCommand(statement).getMessage + err, "ParseException", 2000, e)
}
case e: AnalysisException =>
if (!isClosedOrCanceled) {
onStatementError(statementId, e.getMessage, KyuubiSparkUtil.exceptionString(e))
throw new KyuubiSQLException(e.getMessage, "AnalysisException", 2001, e)
val err = KyuubiSparkUtil.exceptionString(e)
onStatementError(statementId, e.getMessage, err)
throw new KyuubiSQLException(err, "AnalysisException", 2001, e)
}
case e: HiveAccessControlException =>
if (!isClosedOrCanceled) {
onStatementError(statementId, e.getMessage, KyuubiSparkUtil.exceptionString(e))
throw new KyuubiSQLException(e.getMessage, "HiveAccessControlException", 3000, e)
val err = KyuubiSparkUtil.exceptionString(e)
onStatementError(statementId, e.getMessage, err)
throw new KyuubiSQLException(err, "HiveAccessControlException", 3000, e)
}
case e: Throwable =>
if (!isClosedOrCanceled) {
onStatementError(statementId, e.getMessage, KyuubiSparkUtil.exceptionString(e))
throw new KyuubiSQLException(e.toString, "<unknown>", 10000, e)
val err = KyuubiSparkUtil.exceptionString(e)
onStatementError(statementId, e.getMessage, err)
throw new KyuubiSQLException(err, "<unknown>", 10000, e)
}
} finally {
if (statementId != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,17 @@ class SparkSessionWithUGI(
}
}
stopContext()
val ke = new KyuubiSQLException(
s"Get SparkSession for [$userName] failed", "08S01", 1001, findCause(e))
val cause = findCause(e)
val msg =
s"""
|Get SparkSession for [$userName] failed
|Diagnosis:
|${sparkException.map(_.getMessage).getOrElse(cause.getMessage)}
|
|Please check if the specified yarn queue [${conf.getOption(QUEUE).getOrElse("")}]
|is available or has sufficient resources left
""".stripMargin
val ke = new KyuubiSQLException(msg, "08S01", 1001, cause)
sparkException.foreach(ke.addSuppressed)
throw ke
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class SparkSessionWithUGISuite extends SparkFunSuite {
assert(!SparkSessionWithUGI.isPartiallyConstructed(userName1))
val e = intercept[KyuubiSQLException](sparkSessionWithUGI.init(Map.empty))
assert(e.getCause.isInstanceOf[TimeoutException])
assert(e.getMessage.startsWith("Get SparkSession"))
assert(e.getMessage.contains("Get SparkSession"))
}

test("testSetFullyConstructed") {
Expand Down

0 comments on commit 56fa56a

Please sign in to comment.