[SPARK-49099][SQL][FOLLOWUP][3.5] recover tests in DDLSuite
### What changes were proposed in this pull request?
This is a followup of https://github.com/apache/spark/pull/47592 to fix test failure during backport.
### Why are the changes needed?
recover CI
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
existing tests
### Was this patch authored or co-authored using generative AI tooling?
no
Closes #47630 from cloud-fan/fix.
Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Kent Yao <yao@apache.org>
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 dea66bb..1e63350 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
@@ -47,6 +47,7 @@
try {
// drop all databases, tables and functions after each test
spark.sessionState.catalog.reset()
+ spark.sessionState.catalogManager.reset()
} finally {
Utils.deleteRecursively(new File(spark.sessionState.conf.warehousePath))
super.afterEach()
@@ -1120,7 +1121,7 @@
sql("ALTER TABLE dbx.tab1 SET TBLPROPERTIES ('andrew' = 'or14', 'kor' = 'bel')")
assert(getProps == Map("andrew" -> "or14", "kor" -> "bel"))
// set table properties without explicitly specifying database
- catalog.setCurrentDatabase("dbx")
+ spark.sessionState.catalogManager.setCurrentNamespace(Array("dbx"))
sql("ALTER TABLE tab1 SET TBLPROPERTIES ('kor' = 'belle', 'kar' = 'bol')")
assert(getProps == Map("andrew" -> "or14", "kor" -> "belle", "kar" -> "bol"))
// table to alter does not exist
@@ -1154,7 +1155,7 @@
sql("ALTER TABLE dbx.tab1 UNSET TBLPROPERTIES ('j')")
assert(getProps == Map("p" -> "an", "c" -> "lan", "x" -> "y"))
// unset table properties without explicitly specifying database
- catalog.setCurrentDatabase("dbx")
+ spark.sessionState.catalogManager.setCurrentNamespace(Array("dbx"))
sql("ALTER TABLE tab1 UNSET TBLPROPERTIES ('p')")
assert(getProps == Map("c" -> "lan", "x" -> "y"))
// table to alter does not exist
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
index 2c5e295..2fad78e 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
@@ -56,6 +56,7 @@
try {
// drop all databases, tables and functions after each test
spark.sessionState.catalog.reset()
+ spark.sessionState.catalogManager.reset()
} finally {
super.afterEach()
}