aokolnychyi commented on code in PR #52920:
URL: https://github.com/apache/spark/pull/52920#discussion_r2524991741
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala:
##########
@@ -965,8 +965,14 @@ class DataSourceV2SQLSuiteV1Filter
checkAnswer(sql(s"SELECT * FROM $view"),
spark.table("source").select("id"))
val oldView = spark.table(view)
+ assert(spark.sharedState.cacheManager.numCachedEntries == 1)
sql(s"REPLACE TABLE $t (a bigint) USING foo")
-
assert(spark.sharedState.cacheManager.lookupCachedData(oldView).isEmpty)
+ // it is no longer valid to materialize oldView as underlying
+ // query execution captured original table before replace
+ // yet cache invalidation must work correctly
Review Comment:
This behavior isn't coming from changes in `ReplaceTableAsSelect`. What
happens here is that oldView plan gets fully resolved and analyzed with the old
table ID. Then REPLACE drops and recreates another table with a different ID.
After that, the original Dataset becomes out of sync as it was analyzed and
captured the old table ID.
--
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]