Skip to content

Commit bb94d88

Browse files
committed
[SPARK-27739][SQL] df.persist should save stats from optimized plan
1 parent 3e30a98 commit bb94d88

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ class CacheManager extends Logging {
7979
logWarning("Asked to cache already cached data.")
8080
} else {
8181
val sparkSession = query.sparkSession
82+
val qe = sparkSession.sessionState.executePlan(planToCache)
8283
val inMemoryRelation = InMemoryRelation(
8384
sparkSession.sessionState.conf.useCompression,
8485
sparkSession.sessionState.conf.columnBatchSize, storageLevel,
85-
sparkSession.sessionState.executePlan(planToCache).executedPlan,
86+
qe.executedPlan,
8687
tableName,
87-
planToCache)
88+
qe.optimizedPlan)
8889
this.synchronized {
8990
if (lookupCachedData(planToCache).nonEmpty) {
9091
logWarning("Data has already been cached.")

0 commit comments

Comments
 (0)