cloud-fan commented on a change in pull request #27644: [SPARK-30868][SQL]
Throw Exception if runHive(sql) failed
URL: https://github.com/apache/spark/pull/27644#discussion_r382409518
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveExternalCatalogSuite.scala
##########
@@ -154,4 +155,31 @@ class HiveExternalCatalogSuite extends
ExternalCatalogSuite {
catalog.createTable(hiveTable, ignoreIfExists = false)
assert(catalog.getTable("db1", "spark_29498").owner === owner)
}
+
+ test("SPARK-30868 throw an exception if HiveClient#runSqlHive fails") {
+ // test add jars which not exists
+ val jarPath = "file:///tmp/not_exists.jar"
+
assertThrows[QueryExecutionException](externalCatalog.client.runSqlHive(s"ADD
JAR $jarPath"))
+
+ // test change to the database which not exists
+ assertThrows[QueryExecutionException](externalCatalog.client.runSqlHive(
+ s"use db_not_exists"))
+
+ // test create hive table failed
+ val tblName = "table_not_exists"
+ assertThrows[QueryExecutionException](externalCatalog.client.runSqlHive(
+ s"CREATE TABLE $tblName(n into)"))
+
+ // test describe table failed
+ assertThrows[QueryExecutionException](externalCatalog.client.runSqlHive(
+ s"DESC FORMATED $tblName"))
Review comment:
ah i see, then the table name doesn't matter. how about `DESC FORMATED t`?
and add comment to say that `FORMATED` is a wrong word.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]