Skip to content

Commit

Permalink
Add public finalPhysicalPlan that uses withFinalPlanUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Nov 8, 2022
1 parent 769e183 commit 52b7bb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ case class AdaptiveSparkPlanExec(
.map(_.toLong).filter(SQLExecution.getQueryExecution(_) eq context.qe)
}

private[sql] def getFinalPhysicalPlan(): SparkPlan = lock.synchronized {
def finalPhysicalPlan: SparkPlan = withFinalPlanUpdate(identity)

private def getFinalPhysicalPlan(): SparkPlan = lock.synchronized {
if (isFinalPlan) return currentPhysicalPlan

// In case of this adaptive plan being executed out of `withActive` scoped functions, e.g.,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ object FileFormatWriter extends Logging {
// SPARK-40588: plan may contain an AdaptiveSparkPlanExec, which does not know
// its final plan's ordering, so we have to materialize that plan first
def materializeAdaptiveSparkPlan(plan: SparkPlan): SparkPlan = plan match {
case a: AdaptiveSparkPlanExec => a.getFinalPhysicalPlan()
case a: AdaptiveSparkPlanExec => a.finalPhysicalPlan
case p: SparkPlan => p.withNewChildren(p.children.map(materializeAdaptiveSparkPlan))
}
val materializedPlan = materializeAdaptiveSparkPlan(empty2NullPlan)
Expand Down

0 comments on commit 52b7bb6

Please sign in to comment.