Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/3039#discussion_r19679677
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/CacheManager.scala
---
@@ -103,6 +103,17 @@ private[sql] trait CacheManager {
cachedData.remove(dataIndex)
}
+ /** Tries to remove the data for the given SchemaRDD from the cache if
it's cached */
+ private[sql] def tryUncacheQuery(query: SchemaRDD, blocking: Boolean =
true): Boolean = writeLock {
+ val planToCache = query.queryExecution.analyzed
+ val dataIndex = cachedData.indexWhere(cd =>
planToCache.sameResult(cd.plan))
+ val found = dataIndex >= 0
+ if (found) {
+
cachedData(dataIndex).cachedRepresentation.cachedColumnBuffers.unpersist(blocking)
+ cachedData.remove(dataIndex)
+ }
+ found
+ }
--- End diff --
This method is added to ensure `CacheManager` thread safety. (However, the
catalog within `SQLContext` is not thread safe, which should be fixed in
another PR.)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]