Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/18148#discussion_r119968406
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
---
@@ -125,14 +126,36 @@ class SessionCatalog(
if (conf.caseSensitiveAnalysis) name else name.toLowerCase(Locale.ROOT)
}
- /**
- * A cache of qualified table names to table relation plans.
- */
- val tableRelationCache: Cache[QualifiedTableName, LogicalPlan] = {
+ private val tableRelationCache: Cache[QualifiedTableName, LogicalPlan] =
{
val cacheSize = conf.tableRelationCacheSize
CacheBuilder.newBuilder().maximumSize(cacheSize).build[QualifiedTableName,
LogicalPlan]()
}
+ /** This method provides a way to get a cached plan. */
+ def getCachedPlan(t: QualifiedTableName, c: Callable[LogicalPlan]):
LogicalPlan = {
+ tableRelationCache.get(t, c)
+ }
+
+ /** This method provides a way to get a cached plan if the key exists. */
+ def getCachedTableIfPresent(key: QualifiedTableName): LogicalPlan = {
+ tableRelationCache.getIfPresent(key)
+ }
+
+ /** This method provides a way to cache a plan. */
+ def putTableInCache(t: QualifiedTableName, l: LogicalPlan): Unit = {
--- End diff --
`cacheTable`
---
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]