maropu commented on a change in pull request #32430:
URL: https://github.com/apache/spark/pull/32430#discussion_r626996573



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/debug/package.scala
##########
@@ -105,13 +106,20 @@ package object debug {
    * @param plan the query plan for codegen
    * @return Sequence of WholeStageCodegen subtrees and corresponding codegen
    */
-  def codegenStringSeq(plan: SparkPlan): Seq[(String, String, ByteCodeStats)] 
= {
+  def codegenStringSeq(
+      plan: SparkPlan,
+      sparkSession: SparkSession): Seq[(String, String, ByteCodeStats)] = {
     val codegenSubtrees = new 
collection.mutable.HashSet[WholeStageCodegenExec]()
 
     def findSubtrees(plan: SparkPlan): Unit = {
       plan foreach {
         case s: WholeStageCodegenExec =>
           codegenSubtrees += s
+        case p: AdaptiveSparkPlanExec =>
+          // Find subtrees from original input plan of AQE.
+          val inputExecutedPlan = QueryExecution.prepareForExecution(
+            QueryExecution.preparations(sparkSession, None), p.inputPlan)

Review comment:
       Could we use `SparkSession.getActiveSession` to avoid the unnecessary 
changes?




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



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

Reply via email to