beliefer commented on code in PR #43258:
URL: https://github.com/apache/spark/pull/43258#discussion_r1349470075


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala:
##########
@@ -512,4 +513,19 @@ class JDBCTableCatalogSuite extends QueryTest with 
SharedSparkSession {
       assert(t.schema === replaced)
     }
   }
+
+  test("SPARK-45449: Cache Invalidation Issue with JDBC Table") {
+    withConnection { conn =>
+      conn.prepareStatement(
+        """CREATE TABLE "test"."cache_t" (id decimal(25) PRIMARY KEY NOT NULL,
+          |name TEXT(32) NOT NULL)""".stripMargin).executeUpdate()
+    }
+    val ss = spark.cloneSession()
+    ss.sql("insert overwrite h2.test.cache_t select 1 as id, 'a' as name")
+
+    sql("cache table ct1 select id, name from h2.test.cache_t")
+    val plan = sql("select * from ct1").queryExecution.sparkPlan
+    assert(plan.isInstanceOf[InMemoryTableScanExec])

Review Comment:
   Please clear the table cache and drop table at finally block.



##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala:
##########
@@ -512,4 +513,19 @@ class JDBCTableCatalogSuite extends QueryTest with 
SharedSparkSession {
       assert(t.schema === replaced)
     }
   }
+
+  test("SPARK-45449: Cache Invalidation Issue with JDBC Table") {
+    withConnection { conn =>
+      conn.prepareStatement(
+        """CREATE TABLE "test"."cache_t" (id decimal(25) PRIMARY KEY NOT NULL,
+          |name TEXT(32) NOT NULL)""".stripMargin).executeUpdate()
+    }
+    val ss = spark.cloneSession()

Review Comment:
   Why need clone session here?



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