aokolnychyi commented on code in PR #40734:
URL: https://github.com/apache/spark/pull/40734#discussion_r1163081715


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/command/commands.scala:
##########
@@ -163,8 +164,11 @@ case class ExplainCommand(
 
   // Run through the optimizer to generate the physical plan.
   override def run(sparkSession: SparkSession): Seq[Row] = try {
-    val outputString = sparkSession.sessionState.executePlan(logicalPlan, 
CommandExecutionMode.SKIP)
-      .explainString(mode)
+    val qe = sparkSession.sessionState.executePlan(logicalPlan, 
CommandExecutionMode.SKIP)
+    val outputString = qe.explainString(mode)
+    qe.executedPlan.foreach {
+      case staged: HasStagedChanges => staged.abortStagedChanges()

Review Comment:
   Yeah, exactly, that's why I was looking for alternative options too. Let me 
explore the nested execution idea.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to