From 1bb2511a83ea847b798943fe8519ba03b790910b Mon Sep 17 00:00:00 2001 From: Dave DeCaprio Date: Thu, 14 Mar 2019 10:35:51 -0500 Subject: [PATCH] Changed to reference equals for plan removal. --- .../scala/org/apache/spark/sql/execution/CacheManager.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala index 901332f47ab5c..a5f62f43c21c5 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala @@ -129,7 +129,7 @@ class CacheManager extends Logging { } val plansToUncache = cachedData.filter(cd => shouldRemove(cd.plan)) this.synchronized { - cachedData = cachedData.filter(!plansToUncache.contains(_)) + cachedData = cachedData.filterNot(cd => plansToUncache.exists(_ eq cd)) } plansToUncache.foreach { _.cachedRepresentation.cacheBuilder.clearCache(blocking) } @@ -170,7 +170,7 @@ class CacheManager extends Logging { val needToRecache = cachedData.filter(condition) this.synchronized { // Remove the cache entry before creating a new ones. - cachedData = cachedData.filter(!needToRecache.contains(_)) + cachedData = cachedData.filterNot(cd => needToRecache.exists(_ eq cd)) } needToRecache.map { cd => cd.cachedRepresentation.cacheBuilder.clearCache()