cloud-fan commented on code in PR #54427:
URL: https://github.com/apache/spark/pull/54427#discussion_r2843939771
##########
sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala:
##########
@@ -2663,6 +2663,24 @@ class CachedTableSuite extends QueryTest
}
}
+ test("ALTER TABLE invalidates cached table") {
+ val t = "testcat.tbl"
+ withTable(t) {
+ sql(s"CREATE TABLE $t (id int, data string) USING foo")
+ sql(s"INSERT INTO $t VALUES (1, 'a'), (2, 'b')")
+
+ sql(s"CACHE TABLE $t")
+ assertCached(sql(s"SELECT * FROM $t"))
+ checkAnswer(sql(s"SELECT * FROM $t"), Seq(Row(1, "a"), Row(2, "b")))
+
+ sql(s"ALTER TABLE $t ADD COLUMN new_col int")
+
+ val result = sql(s"SELECT * FROM $t ORDER BY id")
+ assertCached(result)
+ checkAnswer(result, Seq(Row(1, "a", null), Row(2, "b", null)))
Review Comment:
what was the error message before this PR?
--
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]