cloud-fan commented on a change in pull request #30187:
URL: https://github.com/apache/spark/pull/30187#discussion_r514830896
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala
##########
@@ -1208,4 +1208,24 @@ class CachedTableSuite extends QueryTest with
SQLTestUtils
assert(spark.sharedState.cacheManager.lookupCachedData(df).isDefined)
}
}
+
+ test("SPARK-33290: REFRESH TABLE should invalidate all caches referencing
the table") {
+ withTable("t") {
+ withTempPath { path =>
+ withTempView("tempView1", "tempView2") {
+ Seq((1 -> "a")).toDF("i", "j").write.parquet(path.getCanonicalPath)
+ sql(s"CREATE TABLE t USING parquet LOCATION '${path.toURI}'")
+ sql("CREATE VIEW tempView1 AS SELECT * FROM t")
+ sql("CACHE TABLE tempView2 AS SELECT i FROM tempView1")
+ checkAnswer(sql("SELECT * FROM tempView1"), Seq(Row(1, "a")))
+ checkAnswer(sql("SELECT * FROM tempView2"), Seq(Row(1)))
+
+ Utils.deleteRecursively(path)
+ sql("REFRESH TABLE tempView1")
Review comment:
does it still work if we only refresh table t?
----------------------------------------------------------------
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]