Skip to content

Commit de674fb

Browse files
committed
fix
1 parent a05d777 commit de674fb

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -893,24 +893,11 @@ private[hive] class HiveClientImpl(
893893
val cmd_1: String = cmd_trimmed.substring(tokens(0).length()).trim()
894894
val results: Try[Seq[String]] = Using(shim.getCommandProcessor(tokens(0), conf)) {
895895
case driver: IDriver =>
896+
driver.run(cmd)
897+
driver.setMaxRows(maxRows)
898+
shim.getDriverResults(driver)
899+
case proc =>
896900
val out = state.getClass.getField("out").get(state)
897-
try {
898-
driver.run(cmd)
899-
driver.setMaxRows(maxRows)
900-
shim.getDriverResults(driver)
901-
} catch {
902-
case e @ (_: QueryExecutionException | _: SparkThrowable) =>
903-
throw e
904-
case e: Exception =>
905-
// Wrap the original hive error with QueryExecutionException and throw it
906-
// if there is an error in query processing.
907-
// This works for hive 4.x and later versions.
908-
throw new QueryExecutionException(Utils.stackTraceToString(e))
909-
} finally {
910-
driver.close
911-
}
912-
913-
case _ =>
914901
if (out != null) {
915902
// scalastyle:off println
916903
out.asInstanceOf[PrintStream].println(tokens(0) + " " + cmd_1)
@@ -930,7 +917,7 @@ private[hive] class HiveClientImpl(
930917
// Wrap the original hive error with QueryExecutionException and throw it
931918
// if there is an error in query processing.
932919
// This works for hive 4.x and later versions.
933-
throw new QueryExecutionException(ExceptionUtils.getStackTrace(e))
920+
throw new QueryExecutionException(Utils.stackTraceToString(e))
934921
}
935922
}
936923
} catch {

0 commit comments

Comments
 (0)