dchvn commented on a change in pull request #35007:
URL: https://github.com/apache/spark/pull/35007#discussion_r774854014
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala
##########
@@ -196,7 +196,15 @@ private[spark] class HiveExternalCatalog(conf: SparkConf,
hadoopConf: Configurat
db: String,
ignoreIfNotExists: Boolean,
cascade: Boolean): Unit = withClient {
- client.dropDatabase(db, ignoreIfNotExists, cascade)
+ try {
+ client.dropDatabase(db, ignoreIfNotExists, cascade)
+ } catch {
+ case NonFatal(exception) =>
+ if
(exception.getClass.getName.equals("org.apache.hadoop.hive.ql.metadata.HiveException")
+ && exception.getMessage.contains(s"Database $db is not empty.")) {
+ throw new AnalysisException(s"Cannot drop a non-empty database: $db")
+ } else throw exception
+ }
Review comment:
Try-catch the error from hive catalog and re-throw it with a different
error message that matches v1, v2
--
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]