aboutsummaryrefslogtreecommitdiff
path: root/sql/core
diff options
context:
space:
mode:
authorgatorsmile <gatorsmile@gmail.com>2016-05-10 11:25:39 -0700
committerAndrew Or <andrew@databricks.com>2016-05-10 11:25:55 -0700
commit5c6b0855787c080d3e233eb09c05c025395e7cb3 (patch)
treeba75170f0e9629e540d9ef5924fbcea185807637 /sql/core
parented0b4070fb50054b1ecf66ff6c32458a4967dfd3 (diff)
downloadspark-5c6b0855787c080d3e233eb09c05c025395e7cb3.tar.gz
spark-5c6b0855787c080d3e233eb09c05c025395e7cb3.tar.bz2
spark-5c6b0855787c080d3e233eb09c05c025395e7cb3.zip
[SPARK-14603][SQL] Verification of Metadata Operations by Session Catalog
Since we cannot really trust if the underlying external catalog can throw exceptions when there is an invalid metadata operation, let's do it in SessionCatalog. - [X] The first step is to unify the error messages issued in Hive-specific Session Catalog and general Session Catalog. - [X] The second step is to verify the inputs of metadata operations for partitioning-related operations. This is moved to a separate PR: https://github.com/apache/spark/pull/12801 - [X] The third step is to add database existence verification in `SessionCatalog` - [X] The fourth step is to add table existence verification in `SessionCatalog` - [X] The fifth step is to add function existence verification in `SessionCatalog` Add test cases and verify the error messages we issued Author: gatorsmile <gatorsmile@gmail.com> Author: xiaoli <lixiao1983@gmail.com> Author: Xiao Li <xiaoli@Xiaos-MacBook-Pro.local> Closes #12385 from gatorsmile/verifySessionAPIs.
Diffstat (limited to 'sql/core')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala14
1 files changed, 7 insertions, 7 deletions
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 5fbab2382a..64b90b1ed6 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
@@ -24,6 +24,7 @@ import org.scalatest.BeforeAndAfterEach
import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
import org.apache.spark.sql.catalyst.TableIdentifier
+import org.apache.spark.sql.catalyst.analysis.DatabaseAlreadyExistsException
import org.apache.spark.sql.catalyst.catalog.{CatalogDatabase, CatalogStorageFormat}
import org.apache.spark.sql.catalyst.catalog.{CatalogColumn, CatalogTable, CatalogTableType}
import org.apache.spark.sql.catalyst.catalog.{CatalogTablePartition, SessionCatalog}
@@ -212,10 +213,9 @@ class DDLSuite extends QueryTest with SharedSQLContext with BeforeAndAfterEach {
expectedLocation,
Map.empty))
- val message = intercept[AnalysisException] {
+ intercept[DatabaseAlreadyExistsException] {
sql(s"CREATE DATABASE $dbName")
- }.getMessage
- assert(message.contains(s"Database '$dbNameWithoutBackTicks' already exists."))
+ }
} finally {
catalog.reset()
}
@@ -280,17 +280,17 @@ class DDLSuite extends QueryTest with SharedSQLContext with BeforeAndAfterEach {
var message = intercept[AnalysisException] {
sql(s"DROP DATABASE $dbName")
}.getMessage
- assert(message.contains(s"Database '$dbNameWithoutBackTicks' does not exist"))
+ assert(message.contains(s"Database '$dbNameWithoutBackTicks' not found"))
message = intercept[AnalysisException] {
sql(s"ALTER DATABASE $dbName SET DBPROPERTIES ('d'='d')")
}.getMessage
- assert(message.contains(s"Database '$dbNameWithoutBackTicks' does not exist"))
+ assert(message.contains(s"Database '$dbNameWithoutBackTicks' not found"))
message = intercept[AnalysisException] {
sql(s"DESCRIBE DATABASE EXTENDED $dbName")
}.getMessage
- assert(message.contains(s"Database '$dbNameWithoutBackTicks' does not exist"))
+ assert(message.contains(s"Database '$dbNameWithoutBackTicks' not found"))
sql(s"DROP DATABASE IF EXISTS $dbName")
}
@@ -1014,7 +1014,7 @@ class DDLSuite extends QueryTest with SharedSQLContext with BeforeAndAfterEach {
sql("DROP DATABASE DeFault")
}.getMessage
if (caseSensitive == "true") {
- assert(message.contains("Database 'DeFault' does not exist"))
+ assert(message.contains("Database 'DeFault' not found"))
} else {
assert(message.contains("Can not drop default database"))
}