class CacheManager extends Logging with AdaptiveSparkPlanHelper
Provides support in a SQLContext for caching query results and automatically using these cached
results when subsequent queries are executed. Data is cached using byte buffers stored in an
InMemoryRelation. This relation is automatically substituted query plans that return the
sameResult
as the originally cached query.
Internal to Spark SQL. All its public APIs take analyzed plans and will normalize them before
further usage, or take Dataset and get its normalized plan. See QueryExecution.normalize
for more details about plan normalization.
- Alphabetic
- By Inheritance
- CacheManager
- AdaptiveSparkPlanHelper
- Logging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new CacheManager()
Type Members
- implicit class LogStringContext extends AnyRef
- Definition Classes
- Logging
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def allChildren(p: SparkPlan): Seq[SparkPlan]
- Attributes
- protected
- Definition Classes
- AdaptiveSparkPlanHelper
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def cacheQuery(spark: classic.SparkSession, planToCache: LogicalPlan, tableName: Option[String], storageLevel: StorageLevel): Unit
Caches the data produced by the given LogicalPlan.
Caches the data produced by the given LogicalPlan. The given plan will be normalized before being used further.
- def cacheQuery(query: classic.Dataset[_], tableName: Option[String], storageLevel: StorageLevel): Unit
Caches the data produced by the logical representation of the given Dataset.
- def cacheQuery(query: classic.Dataset[_]): Unit
- def clearCache(): Unit
Clears all cached tables.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def collect[B](p: SparkPlan)(pf: PartialFunction[SparkPlan, B]): Seq[B]
Returns a Seq containing the result of applying a partial function to all elements in this tree on which the function is defined.
Returns a Seq containing the result of applying a partial function to all elements in this tree on which the function is defined.
- Definition Classes
- AdaptiveSparkPlanHelper
- def collectFirst[B](p: SparkPlan)(pf: PartialFunction[SparkPlan, B]): Option[B]
Finds and returns the first SparkPlan of the tree for which the given partial function is defined (pre-order), and applies the partial function to it.
Finds and returns the first SparkPlan of the tree for which the given partial function is defined (pre-order), and applies the partial function to it.
- Definition Classes
- AdaptiveSparkPlanHelper
- def collectLeaves(p: SparkPlan): Seq[SparkPlan]
Returns a Seq containing the leaves in this tree.
Returns a Seq containing the leaves in this tree.
- Definition Classes
- AdaptiveSparkPlanHelper
- def collectWithSubqueries[B](p: SparkPlan)(f: PartialFunction[SparkPlan, B]): Seq[B]
Returns a sequence containing the result of applying a partial function to all elements in this plan, also considering all the plans in its (nested) subqueries
Returns a sequence containing the result of applying a partial function to all elements in this plan, also considering all the plans in its (nested) subqueries
- Definition Classes
- AdaptiveSparkPlanHelper
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def find(p: SparkPlan)(f: (SparkPlan) => Boolean): Option[SparkPlan]
Find the first SparkPlan that satisfies the condition specified by
f
.Find the first SparkPlan that satisfies the condition specified by
f
. The condition is recursively applied to this node and all of its children (pre-order).- Definition Classes
- AdaptiveSparkPlanHelper
- def flatMap[A](p: SparkPlan)(f: (SparkPlan) => IterableOnce[A]): Seq[A]
Returns a Seq by applying a function to all nodes in this tree and using the elements of the resulting collections.
Returns a Seq by applying a function to all nodes in this tree and using the elements of the resulting collections.
- Definition Classes
- AdaptiveSparkPlanHelper
- def foreach(p: SparkPlan)(f: (SparkPlan) => Unit): Unit
Runs the given function on this node and then recursively on children.
Runs the given function on this node and then recursively on children.
- f
the function to be applied to each node in the tree.
- Definition Classes
- AdaptiveSparkPlanHelper
- def foreachUp(p: SparkPlan)(f: (SparkPlan) => Unit): Unit
Runs the given function recursively on children then on this node.
Runs the given function recursively on children then on this node.
- f
the function to be applied to each node in the tree.
- Definition Classes
- AdaptiveSparkPlanHelper
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def initializeLogIfNecessary(isInterpreter: Boolean): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def isEmpty: Boolean
Checks if the cache is empty.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isSubDir(qualifiedPathParent: Path, qualifiedPathChild: Path): Boolean
Checks if the given child path is a sub-directory of the given parent path.
Checks if the given child path is a sub-directory of the given parent path.
- returns
True if the child path is a sub-directory of the given parent path. Otherwise, false.
- def isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def log: Logger
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logName: String
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def lookupCachedData(session: classic.SparkSession, plan: LogicalPlan): Option[CachedData]
Optionally returns cached data for the given LogicalPlan.
Optionally returns cached data for the given LogicalPlan. The given plan will be normalized before being used further.
- def lookupCachedData(query: classic.Dataset[_]): Option[CachedData]
Optionally returns cached data for the given Dataset
- def mapPlans[A](p: SparkPlan)(f: (SparkPlan) => A): Seq[A]
Returns a Seq containing the result of applying the given function to each node in this tree in a preorder traversal.
Returns a Seq containing the result of applying the given function to each node in this tree in a preorder traversal.
- f
the function to be applied.
- Definition Classes
- AdaptiveSparkPlanHelper
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def recacheByPath(spark: classic.SparkSession, resourcePath: Path, fs: FileSystem): Unit
Tries to re-cache all the cache entries that contain
resourcePath
in one or moreHadoopFsRelation
node(s) as part of its logical plan. - def recacheByPath(spark: classic.SparkSession, resourcePath: String): Unit
Tries to re-cache all the cache entries that contain
resourcePath
in one or moreHadoopFsRelation
node(s) as part of its logical plan. - def recacheByPlan(spark: classic.SparkSession, plan: LogicalPlan): Unit
Tries to re-cache all the cache entries that refer to the given plan.
Tries to re-cache all the cache entries that refer to the given plan. The given plan will be normalized before being used further.
- def stripAQEPlan(p: SparkPlan): SparkPlan
Strip the top AdaptiveSparkPlanExec and ResultQueryStageExec nodes off the SparkPlan.
Strip the top AdaptiveSparkPlanExec and ResultQueryStageExec nodes off the SparkPlan.
- Definition Classes
- AdaptiveSparkPlanHelper
- def subqueriesAll(p: SparkPlan): Seq[SparkPlan]
Returns a sequence containing the subqueries in this plan, also including the (nested) subqueries in its children
Returns a sequence containing the subqueries in this plan, also including the (nested) subqueries in its children
- Definition Classes
- AdaptiveSparkPlanHelper
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def uncacheQuery(spark: classic.SparkSession, plan: LogicalPlan, cascade: Boolean): Unit
- def uncacheQuery(spark: classic.SparkSession, plan: LogicalPlan, cascade: Boolean, blocking: Boolean): Unit
Un-cache the given plan or all the cache entries that refer to the given plan.
Un-cache the given plan or all the cache entries that refer to the given plan.
- spark
The Spark session.
- plan
The plan to be un-cached.
- cascade
If true, un-cache all the cache entries that refer to the given plan; otherwise un-cache the given plan only.
- blocking
Whether to block until all blocks are deleted.
- def uncacheQuery(query: classic.Dataset[_], cascade: Boolean): Unit
- def uncacheQuery(query: classic.Dataset[_], cascade: Boolean, blocking: Boolean): Unit
Un-cache the given plan or all the cache entries that refer to the given plan.
Un-cache the given plan or all the cache entries that refer to the given plan.
- query
The Dataset to be un-cached.
- cascade
If true, un-cache all the cache entries that refer to the given Dataset; otherwise un-cache the given Dataset only.
- blocking
Whether to block until all blocks are deleted.
- def uncacheTableOrView(spark: classic.SparkSession, name: Seq[String], cascade: Boolean): Unit
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withLogContext(context: Map[String, String])(body: => Unit): Unit
- Attributes
- protected
- Definition Classes
- Logging
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)