diff options
author | Cheng Hao <hao.cheng@intel.com> | 2014-08-01 11:42:05 -0700 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2014-08-01 11:42:05 -0700 |
commit | c0b47bada3c9f0e9e0f14ab41ffb91012a357211 (patch) | |
tree | e948889fd25df43f35d33b8baddb195e87968a59 /sql/hive-thriftserver/src | |
parent | 580c7011cab6bc93294b6486e778557216bedb10 (diff) | |
download | spark-c0b47bada3c9f0e9e0f14ab41ffb91012a357211.tar.gz spark-c0b47bada3c9f0e9e0f14ab41ffb91012a357211.tar.bz2 spark-c0b47bada3c9f0e9e0f14ab41ffb91012a357211.zip |
[SPARK-2767] [SQL] SparkSQL CLI doens't output error message if query failed.
Author: Cheng Hao <hao.cheng@intel.com>
Closes #1686 from chenghao-intel/spark_sql_cli and squashes the following commits:
eb664cc [Cheng Hao] Output detailed failure message in console
93b0382 [Cheng Hao] Fix Bug of no output in cli if exception thrown internally
Diffstat (limited to 'sql/hive-thriftserver/src')
2 files changed, 4 insertions, 3 deletions
diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala index 27268ecb92..cb17d7ce58 100755 --- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala +++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala @@ -288,8 +288,10 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging { out.println(cmd) } - ret = driver.run(cmd).getResponseCode + val rc = driver.run(cmd) + ret = rc.getResponseCode if (ret != 0) { + console.printError(rc.getErrorMessage()) driver.close() return ret } diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala index 5202aa9903..a56b19a4bc 100644 --- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala +++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLDriver.scala @@ -53,10 +53,9 @@ private[hive] class SparkSQLDriver(val context: HiveContext = SparkSQLEnv.hiveCo } override def run(command: String): CommandProcessorResponse = { - val execution = context.executePlan(context.hql(command).logicalPlan) - // TODO unify the error code try { + val execution = context.executePlan(context.hql(command).logicalPlan) hiveResponse = execution.stringResult() tableSchema = getResultSetSchema(execution) new CommandProcessorResponse(0) |