MaxGekk commented on code in PR #28499:
URL: https://github.com/apache/spark/pull/28499#discussion_r950513186
##########
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala:
##########
@@ -380,10 +380,18 @@ private[hive] class SparkSQLCLIDriver extends CliDriver
with Logging {
ret = rc.getResponseCode
if (ret != 0) {
- // For analysis exception, only the error is printed out to the
console.
- rc.getException() match {
- case e : AnalysisException =>
- err.println(s"""Error in query: ${e.getMessage}""")
+ rc.getException match {
+ case e: AnalysisException => e.cause match {
+ case Some(_) if !sessionState.getIsSilent =>
+ err.println(
+ s"""Error in query: ${e.getMessage}
+
|${org.apache.hadoop.util.StringUtils.stringifyException(e)}
Review Comment:
Actually, this prints the error message twice. For example:
```
spark-sql> select date_sub(date'2011-11-11', '1.2');
Error in query: [SECOND_FUNCTION_ARGUMENT_NOT_INTEGER] The second argument
of date_sub function needs to be an integer.
org.apache.spark.sql.AnalysisException:
[SECOND_FUNCTION_ARGUMENT_NOT_INTEGER] The second argument of date_sub function
needs to be an integer.
```
`e.getMessage` can be omitted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]