Github user wzhfy commented on the issue:

    https://github.com/apache/spark/pull/16401
  
    With the above change, in my understanding, we will call 
`plan.invalidateStatsCache` when the conf is changed? Otherwise the stats cache 
is invalidated only when it's None.
    How about adding a flag `statsConfChanged: Boolean` in SparkSession, when 
cbo related conf is changed, we set statsConfChanged to true. Then in 
LogicalPlan:
    ```
    def stats(conf: CatalystConf, statsConfChanged: Boolean): Statistics =  {
      if (statsConfChanged) {
        invalidateStatsCache()
      }
      statsCache.getOrElse {
        statsCache = Some(computeStats(conf))
        statsCache.get . //technically this is not correct due to 
multi-threading ... but that's an easy fix
      }
    }
    
    def invalidateStatsCache(): Unit = {
      statsCache = None
      children.foreach(_.invalidateStatsCache())
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to