cloud-fan commented on a change in pull request #25111: [SPARK-28346][SQL]
clone the query plan between analyzer, optimizer and planner
URL: https://github.com/apache/spark/pull/25111#discussion_r305412647
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala
##########
@@ -60,36 +60,31 @@ class QueryExecution(
lazy val analyzed: LogicalPlan =
tracker.measurePhase(QueryPlanningTracker.ANALYSIS) {
SparkSession.setActiveSession(sparkSession)
+ // We can't clone `logical` here, which will reset the `_analyzed` flag.
sparkSession.sessionState.analyzer.executeAndCheck(logical, tracker)
}
lazy val withCachedData: LogicalPlan = {
assertAnalyzed()
assertSupported()
- sparkSession.sharedState.cacheManager.useCachedData(analyzed)
+ sparkSession.sharedState.cacheManager.useCachedData(analyzed.clone())
}
lazy val optimizedPlan: LogicalPlan =
tracker.measurePhase(QueryPlanningTracker.OPTIMIZATION) {
- sparkSession.sessionState.optimizer.executeAndTrack(withCachedData,
tracker)
+
sparkSession.sessionState.optimizer.executeAndTrack(withCachedData.clone(),
tracker)
Review comment:
test added
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]