This is an automated email from the ASF dual-hosted git repository.
yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 9f28c43a127d [SPARK-47315][SQL][TEST] Clean up tempView for
`createTempView` UT
9f28c43a127d is described below
commit 9f28c43a127dbe96e718af3a94f7d85a3d0d8aff
Author: Zhen Wang <[email protected]>
AuthorDate: Thu Mar 7 16:53:12 2024 +0800
[SPARK-47315][SQL][TEST] Clean up tempView for `createTempView` UT
### What changes were proposed in this pull request?
Clean up `tempView` for `createTempView` UT
### Why are the changes needed?
`tempView` created in `createTempView` UT is not cleaned up.
https://github.com/apache/spark/blob/3ec79a9df06f3b5bd28347238a8dfad616ce42d9/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala#L1433
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
no need
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #45417 from wForget/hotfix.
Authored-by: Zhen Wang <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
---
.../scala/org/apache/spark/sql/DatasetSuite.scala | 24 ++++++++++++----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
index fe295b0cfa26..bb18769a23b4 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
@@ -1420,18 +1420,20 @@ class DatasetSuite extends QueryTest
dataset.sparkSession.catalog.dropTempView("tempView")
withDatabase("test_db") {
-
withSQLConf(SQLConf.ALLOW_TEMP_VIEW_CREATION_WITH_MULTIPLE_NAME_PARTS.key ->
"false") {
- spark.sql("CREATE DATABASE IF NOT EXISTS test_db")
- val e = intercept[AnalysisException](
- dataset.createTempView("test_db.tempView"))
- checkError(e,
- errorClass = "TEMP_VIEW_NAME_TOO_MANY_NAME_PARTS",
- parameters = Map("actualName" -> "test_db.tempView"))
- }
+ withTempView("tempView") {
+
withSQLConf(SQLConf.ALLOW_TEMP_VIEW_CREATION_WITH_MULTIPLE_NAME_PARTS.key ->
"false") {
+ spark.sql("CREATE DATABASE IF NOT EXISTS test_db")
+ val e = intercept[AnalysisException](
+ dataset.createTempView("test_db.tempView"))
+ checkError(e,
+ errorClass = "TEMP_VIEW_NAME_TOO_MANY_NAME_PARTS",
+ parameters = Map("actualName" -> "test_db.tempView"))
+ }
-
withSQLConf(SQLConf.ALLOW_TEMP_VIEW_CREATION_WITH_MULTIPLE_NAME_PARTS.key ->
"true") {
- dataset.createTempView("test_db.tempView")
- assert(spark.catalog.tableExists("tempView"))
+
withSQLConf(SQLConf.ALLOW_TEMP_VIEW_CREATION_WITH_MULTIPLE_NAME_PARTS.key ->
"true") {
+ dataset.createTempView("test_db.tempView")
+ assert(spark.catalog.tableExists("tempView"))
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]