LuciferYang commented on a change in pull request #31517: URL: https://github.com/apache/spark/pull/31517#discussion_r677082323
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala ########## @@ -159,19 +160,22 @@ class SessionCatalog( } private val tableRelationCache: Cache[QualifiedTableName, LogicalPlan] = { - var builder = CacheBuilder.newBuilder() + var builder = Caffeine.newBuilder() .maximumSize(cacheSize) if (cacheTTL > 0) { builder = builder.expireAfterWrite(cacheTTL, TimeUnit.SECONDS) } - - builder.build[QualifiedTableName, LogicalPlan]() + // Wrapping as CaffeinatedGuava to be compatible with + // the get(key, valueLoader) API of Guava cache + builder.build() } /** This method provides a way to get a cached plan. */ def getCachedPlan(t: QualifiedTableName, c: Callable[LogicalPlan]): LogicalPlan = { - tableRelationCache.get(t, c) + tableRelationCache.get(t, new JFunction[QualifiedTableName, LogicalPlan] { Review comment: d69df8e fixed these comments. The change of here need to see if it can be compiled ########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala ########## @@ -159,19 +160,22 @@ class SessionCatalog( } private val tableRelationCache: Cache[QualifiedTableName, LogicalPlan] = { - var builder = CacheBuilder.newBuilder() + var builder = Caffeine.newBuilder() .maximumSize(cacheSize) if (cacheTTL > 0) { builder = builder.expireAfterWrite(cacheTTL, TimeUnit.SECONDS) } - - builder.build[QualifiedTableName, LogicalPlan]() + // Wrapping as CaffeinatedGuava to be compatible with + // the get(key, valueLoader) API of Guava cache + builder.build() } /** This method provides a way to get a cached plan. */ def getCachedPlan(t: QualifiedTableName, c: Callable[LogicalPlan]): LogicalPlan = { - tableRelationCache.get(t, c) + tableRelationCache.get(t, new JFunction[QualifiedTableName, LogicalPlan] { Review comment: d69df8e fixed these comments. The change of there need to see if it can be compiled -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org