bowenliang123 commented on code in PR #5225:
URL: https://github.com/apache/kyuubi/pull/5225#discussion_r1311554797
##########
extensions/spark/kyuubi-spark-connector-hive/src/test/scala/org/apache/kyuubi/spark/connector/hive/command/DropNamespaceSuite.scala:
##########
@@ -70,10 +71,15 @@ trait DropNamespaceSuiteBase extends DDLCommandTestUtils {
checkNamespace(Seq(namespace) ++ builtinNamespace)
// $catalog.ns.table is present, thus $catalog.ns cannot be dropped.
- val e = intercept[IllegalStateException] {
+ val e = intercept[AnalysisException] {
sql(s"DROP NAMESPACE $catalogName.$namespace")
}
- assert(e.getMessage.contains(s"Namespace $namespace is not empty"))
+ if (SPARK_RUNTIME_VERSION >= "3.4") {
+ assert(e.getMessage().contains(
+ s"[SCHEMA_NOT_EMPTY] Cannot drop a schema `$namespace` because it
contains objects"))
+ } else {
+ assert(e.getMessage().contains("Use CASCADE option to drop a non-empty
database"))
+ }
Review Comment:
```
interceptContains[AnalysisException] {
sql(s"DROP NAMESPACE $catalogName.$namespace")
}(if (SPARK_RUNTIME_VERSION >= "3.4") {
s"[SCHEMA_NOT_EMPTY] Cannot drop a schema `$namespace` because it
contains objects"
} else {
"Use CASCADE option to drop a non-empty database"
})
```
There's a new-added helper method `interceptContains` available in
`AssertionUtils` of the master branch helps simplify asserting exception
messages.
--
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]