Skip to content

Commit 9821ea1

Browse files
author
Reza Safi
committed
Making tableRelationCache private and updating the comments.
1 parent 8253bbe commit 9821ea1

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,51 +126,41 @@ class SessionCatalog(
126126
if (conf.caseSensitiveAnalysis) name else name.toLowerCase(Locale.ROOT)
127127
}
128128

129-
/**
130-
* A cache of qualified table names to table relation plans.
131-
* Accessing tableRelationCache directly is not recommended,
132-
* since it will introduce exposures to guava libraries.
133-
*/
134-
val tableRelationCache: Cache[QualifiedTableName, LogicalPlan] = {
129+
private val tableRelationCache: Cache[QualifiedTableName, LogicalPlan] = {
135130
val cacheSize = conf.tableRelationCacheSize
136131
CacheBuilder.newBuilder().maximumSize(cacheSize).build[QualifiedTableName, LogicalPlan]()
137132
}
138133

139134
/**
140-
* This method provides a way to get a cached plan
141-
* without exposing components to Guava library.
135+
* This method provides a way to get a cached plan.
142136
*/
143137
def getCachedPlan(t: QualifiedTableName, c: Callable[LogicalPlan]): LogicalPlan = {
144138
tableRelationCache.get(t, c)
145139
}
146140

147141
/**
148-
* This method provides a way to get a cached plan if the key exists
149-
* without exposing components to Guava library.
142+
* This method provides a way to get a cached plan if the key exists.
150143
*/
151144
def getCachedTableIfPresent(key: QualifiedTableName): LogicalPlan = {
152145
tableRelationCache.getIfPresent(key)
153146
}
154147

155148
/**
156-
* This method provides a way to cache a plan
157-
* without exposing components to Guava library.
149+
* This method provides a way to cache a plan.
158150
*/
159151
def putTableInCache(t: QualifiedTableName, l: LogicalPlan): Unit = {
160152
tableRelationCache.put(t, l)
161153
}
162154

163155
/**
164-
* This method provides a way to invalidate a cached plan
165-
* without exposing components to Guava library.
156+
* This method provides a way to invalidate a cached plan.
166157
*/
167158
def invalidateCachedTable(key: QualifiedTableName): Unit = {
168159
tableRelationCache.invalidate(key)
169160
}
170161

171162
/**
172-
* This method provides a way to invalidate all the cached plans
173-
* without exposing components to Guava library.
163+
* This method provides a way to invalidate all the cached plans.
174164
*/
175165
def invalidateAllCachedTables(): Unit = {
176166
tableRelationCache.invalidateAll()

0 commit comments

Comments
 (0)