public class CacheManager extends Object implements Logging
sameResult as the originally cached query.
Internal to Spark SQL.
| Constructor and Description |
|---|
CacheManager(SQLContext sqlContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheQuery(DataFrame query,
scala.Option<String> tableName,
StorageLevel storageLevel)
Caches the data produced by the logical representation of the given schema rdd.
|
void |
cacheTable(String tableName)
Caches the specified table in-memory.
|
void |
clearCache()
Clears all cached tables.
|
void |
invalidateCache(org.apache.spark.sql.catalyst.plans.logical.LogicalPlan plan)
Invalidates the cache of any data that contains
plan. |
boolean |
isCached(String tableName)
Returns true if the table is currently cached in-memory.
|
boolean |
isEmpty()
Checks if the cache is empty.
|
scala.Option<CachedData> |
lookupCachedData(DataFrame query)
Optionally returns cached data for the given
DataFrame |
scala.Option<CachedData> |
lookupCachedData(org.apache.spark.sql.catalyst.plans.logical.LogicalPlan plan)
Optionally returns cached data for the given LogicalPlan.
|
boolean |
tryUncacheQuery(DataFrame query,
boolean blocking)
Tries to remove the data for the given
DataFrame from the cache if it's cached |
void |
uncacheQuery(DataFrame query,
boolean blocking)
Removes the data for the given
DataFrame from the cache |
void |
uncacheTable(String tableName)
Removes the specified table from the in-memory cache.
|
org.apache.spark.sql.catalyst.plans.logical.LogicalPlan |
useCachedData(org.apache.spark.sql.catalyst.plans.logical.LogicalPlan plan)
Replaces segments of the given logical plan with cached versions where possible.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarningpublic CacheManager(SQLContext sqlContext)
public boolean isCached(String tableName)
public void cacheTable(String tableName)
public void uncacheTable(String tableName)
public void clearCache()
public boolean isEmpty()
public void cacheQuery(DataFrame query, scala.Option<String> tableName, StorageLevel storageLevel)
RDD.cache(), the default storage level is set to be MEMORY_AND_DISK because recomputing
the in-memory columnar representation of the underlying table is expensive.public void uncacheQuery(DataFrame query, boolean blocking)
DataFrame from the cachepublic boolean tryUncacheQuery(DataFrame query, boolean blocking)
DataFrame from the cache if it's cachedpublic scala.Option<CachedData> lookupCachedData(DataFrame query)
DataFramepublic scala.Option<CachedData> lookupCachedData(org.apache.spark.sql.catalyst.plans.logical.LogicalPlan plan)
public org.apache.spark.sql.catalyst.plans.logical.LogicalPlan useCachedData(org.apache.spark.sql.catalyst.plans.logical.LogicalPlan plan)
public void invalidateCache(org.apache.spark.sql.catalyst.plans.logical.LogicalPlan plan)
plan. Note that it is possible that this
function will over invalidate.