Github user hvanhovell commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19864#discussion_r154970842
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala ---
    @@ -94,14 +94,16 @@ class CacheManager extends Logging {
           logWarning("Asked to cache already cached data.")
         } else {
           val sparkSession = query.sparkSession
    -      cachedData.add(CachedData(
    -        planToCache,
    -        InMemoryRelation(
    -          sparkSession.sessionState.conf.useCompression,
    -          sparkSession.sessionState.conf.columnBatchSize,
    -          storageLevel,
    -          sparkSession.sessionState.executePlan(planToCache).executedPlan,
    -          tableName)))
    +      val inMemoryRelation = InMemoryRelation(
    +        sparkSession.sessionState.conf.useCompression,
    +        sparkSession.sessionState.conf.columnBatchSize,
    +        storageLevel,
    +        sparkSession.sessionState.executePlan(planToCache).executedPlan,
    +        tableName)
    +      if (planToCache.conf.cboEnabled && 
planToCache.stats.rowCount.isDefined) {
    +        inMemoryRelation.setStatsFromCachedPlan(planToCache)
    +      }
    --- End diff --
    
    `InMemoryRelation` is not part of the public API and should be treated as 
unstable/internal. You can use it at your own risk. Changing the constructor is 
fine.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to