linhongliu-db commented on code in PR #59890:
URL: https://github.com/apache/spark/pull/59890#discussion_r4590108283
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala:
##########
@@ -634,26 +636,45 @@ class CacheManager extends Logging with
AdaptiveSparkPlanHelper {
fs: FileSystem,
includeTimeTravel: Boolean): Unit = {
val qualifiedPath = fs.makeQualified(resourcePath)
+ // recacheByCondition eagerly filters all entries before rebuilding any of
them, so an
+ // index shared across entries needs refreshing only once during this
call. Use object
+ // identity: equal root paths can have independent file-listing caches.
+ val refreshedIndexes = Collections.newSetFromMap(
+ new IdentityHashMap[FileIndex, java.lang.Boolean]())
recacheByCondition(
spark,
- _.plan.exists(lookupAndRefresh(_, fs, qualifiedPath, includeTimeTravel)))
+ cached => {
+ var refreshed = false
+ // lookupAndRefresh has side effects: exists would stop after the
first matching read.
+ // Refresh matching indexes in the operator tree before rebuilding a
multi-read cache.
+ // As before, this traversal does not enter plans held by subquery
expressions.
Review Comment:
Removed in 565abcd.
##########
sql/core/src/test/scala/org/apache/spark/sql/CachedTableSuite.scala:
##########
@@ -855,6 +856,166 @@ class CachedTableSuite extends SharedSparkSession
}
}
+ private def appendParquetWithoutRefresh(path: String, value: Long): Unit = {
Review Comment:
Moved `appendParquetWithoutRefresh` next to the other refresh helpers in
565abcd.
--
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]