Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ case class AdaptiveSparkPlanExec(
@transient private val collapseCodegenStagesRule: Rule[SparkPlan] =
CollapseCodegenStages()

private val isAQECachedDataFrameSupportEnabled = context.session.sessionState.conf.getConf(
SQLConf.CAN_CHANGE_CACHED_PLAN_OUTPUT_PARTITIONING)

// A list of physical optimizer rules to be applied right after a new stage is created. The input
// plan to these rules has exchange as its root node.
private def postStageCreationRules(outputsColumnar: Boolean) = Seq(
Expand Down Expand Up @@ -345,6 +348,16 @@ case class AdaptiveSparkPlanExec(
if (!isSubquery && currentPhysicalPlan.exists(_.subqueries.nonEmpty)) {
getExecutionId.foreach(onUpdatePlan(_, Seq.empty))
}

// Need to post final subPlan changes under InMemoryRelation(IMR) by supporting AQE under IMR
if (isAQECachedDataFrameSupportEnabled) {
val executionId = getExecutionId.orElse {
Option(context.session.sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY))
.map(_.toLong)
}
executionId.foreach(onUpdatePlan(_, Seq.empty))
}

logOnLevel(s"Final plan:\n$currentPhysicalPlan")
}

Expand Down