cloud-fan commented on a change in pull request #30147:
URL: https://github.com/apache/spark/pull/30147#discussion_r512768618



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/connector/SupportsCatalogOptionsSuite.scala
##########
@@ -254,6 +255,24 @@ class SupportsCatalogOptionsSuite extends QueryTest with 
SharedSparkSession with
     }
   }
 
+  test("SPARK-33240: fail the query when instantiation on session catalog 
fails") {
+    val oldCatalogImpl = 
spark.conf.getOption(V2_SESSION_CATALOG_IMPLEMENTATION.key)
+    try {
+      spark.sessionState.catalogManager.reset()
+      spark.conf.set(
+        V2_SESSION_CATALOG_IMPLEMENTATION.key, "InvalidCatalogClass")
+      val e = intercept[SparkException] {
+        sql(s"create table t1 (id bigint) using $format")
+      }
+
+      assert(e.getMessage.contains("Cannot find catalog plugin class"))
+      assert(e.getMessage.contains("InvalidCatalogClass"))
+    } finally {
+      spark.sessionState.catalogManager.reset()
+      oldCatalogImpl.foreach { cat => 
spark.conf.set(V2_SESSION_CATALOG_IMPLEMENTATION.key, cat) }

Review comment:
       This is already set/unset in `before` and `afterEach`




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to