aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwindpiger <songjun@outlook.com>2017-03-16 08:44:57 +0800
committerWenchen Fan <wenchen@databricks.com>2017-03-16 08:44:57 +0800
commitfc9314671c8a082ae339fd6df177a2b684c65d40 (patch)
tree768e0fce68c324eec609fcb8a0915bcad42e1954
parent339b237dc18d4367b0735236b4b8be2901fcad79 (diff)
downloadspark-fc9314671c8a082ae339fd6df177a2b684c65d40.tar.gz
spark-fc9314671c8a082ae339fd6df177a2b684c65d40.tar.bz2
spark-fc9314671c8a082ae339fd6df177a2b684c65d40.zip
[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.
-rw-r--r--sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala2
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala8
2 files changed, 3 insertions, 7 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala
index 5cc6b0abc6..cdf618aef9 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala
@@ -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.")
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
index 6eed10ec51..dd76fdde06 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
@@ -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)