HyukjinKwon commented on a change in pull request #33461:
URL: https://github.com/apache/spark/pull/33461#discussion_r674457920



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLViewTestSuite.scala
##########
@@ -381,6 +381,21 @@ class LocalTempViewTestSuite extends SQLViewTestSuite with 
SharedSparkSession {
   override protected def tableIdentifier(viewName: String): TableIdentifier = {
     TableIdentifier(viewName)
   }
+
+  test("SPARK-36243: tableExists should report correctly on temporary view") {
+    Seq(true, false).foreach { storeAnalyzed =>
+      withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> storeAnalyzed.toString) {
+        val tblIdent = tableIdentifier("v")
+        assert(!spark.sessionState.catalog.tableExists(tblIdent))
+        val viewName = createView("v", "SELECT 1")
+        withView(viewName) {
+          assert(spark.sessionState.catalog.isTempView(tableIdentifier("v")))

Review comment:
       The test here seems failing:
   
   ```
   sbt.ForkMain$ForkError: org.scalatest.exceptions.TestFailedException: 
LocalTempViewTestSuite.this.spark.sessionState.catalog.tableExists(LocalTempViewTestSuite.this.tableIdentifier("v"))
 was false
        at 
org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
        at 
org.scalatest.Assertions.newAssertionFailedException$(Assertions.scala:471)
        at 
org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1231)
        at 
org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:1295)
        at 
org.apache.spark.sql.execution.LocalTempViewTestSuite.$anonfun$new$87(SQLViewTestSuite.scala:392)
        at 
scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1468)
        at 
org.apache.spark.sql.test.SQLTestUtilsBase.withView(SQLTestUtils.scala:316)
        at 
org.apache.spark.sql.test.SQLTestUtilsBase.withView$(SQLTestUtils.scala:314)
   ```




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

Reply via email to