Skip to content
Snippets Groups Projects
Commit fc931467 authored by windpiger's avatar windpiger Committed by Wenchen Fan
Browse files

[SPARK-19961][SQL][MINOR] unify a erro msg when drop databse for...

[SPARK-19961][SQL][MINOR] unify a erro msg when drop databse for HiveExternalCatalog and InMemoryCatalog

## What changes were proposed in this pull request?

unify a exception erro msg for dropdatabase when the database still have some tables for HiveExternalCatalog and InMemoryCatalog
## How was this patch tested?
N/A

Author: windpiger <songjun@outlook.com>

Closes #17305 from windpiger/unifyErromsg.
parent 339b237d
No related branches found
No related tags found
No related merge requests found
......@@ -127,7 +127,7 @@ class InMemoryCatalog(
if (!cascade) {
// If cascade is false, make sure the database is empty.
if (catalog(db).tables.nonEmpty) {
throw new AnalysisException(s"Database '$db' is not empty. One or more tables exist.")
throw new AnalysisException(s"Database $db is not empty. One or more tables exist.")
}
if (catalog(db).functions.nonEmpty) {
throw new AnalysisException(s"Database '$db' is not empty. One or more functions exist.")
......
......@@ -617,12 +617,8 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
val message = intercept[AnalysisException] {
sql(s"DROP DATABASE $dbName RESTRICT")
}.getMessage
// TODO: Unify the exception.
if (isUsingHiveMetastore) {
assert(message.contains(s"Database $dbName is not empty. One or more tables exist"))
} else {
assert(message.contains(s"Database '$dbName' is not empty. One or more tables exist"))
}
assert(message.contains(s"Database $dbName is not empty. One or more tables exist"))
catalog.dropTable(tableIdent1, ignoreIfNotExists = false, purge = false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment