cloud-fan commented on a change in pull request #33067:
URL: https://github.com/apache/spark/pull/33067#discussion_r658473498



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/ExplainSuite.scala
##########
@@ -547,30 +547,107 @@ class ExplainSuiteAE extends ExplainSuiteHelper with 
EnableAdaptiveExecutionSuit
     //                         +- BroadcastExchange (4)
     //                            +- * Project (3)
     //                               +- * LocalTableScan (2)
+    // +- == Initial Plan ==
+    //    HashAggregate (20)
+    //    +- Exchange (19)
+    //       +- HashAggregate (18)
+    //          +- Project (17)
+    //             +- BroadcastHashJoin Inner BuildRight (16)
+    //                :- Project (14)
+    //                :  +- LocalTableScan (13)
+    //                +- BroadcastExchange (15)
+    //                   +- Project (3)
+    //                      +- LocalTableScan (2)
     checkKeywordsExistsInExplain(
       testDf,
       FormattedMode,
-      s"""
-         |(5) BroadcastQueryStage
-         |Output [2]: [k#x, v2#x]
-         |Arguments: 0
-         |""".stripMargin,
-      s"""
-         |(10) ShuffleQueryStage
-         |Output [5]: [k#x, count#xL, sum#xL, sum#x, count#xL]
-         |Arguments: 1
-         |""".stripMargin,
-      s"""
-         |(11) CustomShuffleReader
-         |Input [5]: [k#x, count#xL, sum#xL, sum#x, count#xL]
-         |Arguments: coalesced
-         |""".stripMargin,
-      s"""
-         |(13) AdaptiveSparkPlan
-         |Output [4]: [k#x, count(v1)#xL, sum(v1)#xL, avg(v2)#x]
-         |Arguments: isFinalPlan=true
-         |""".stripMargin
+      """
+        |(5) BroadcastQueryStage
+        |Output [2]: [k#x, v2#x]
+        |Arguments: 0""".stripMargin,
+      """
+        |(10) ShuffleQueryStage
+        |Output [5]: [k#x, count#xL, sum#xL, sum#x, count#xL]
+        |Arguments: 1""".stripMargin,
+      """
+        |(11) CustomShuffleReader
+        |Input [5]: [k#x, count#xL, sum#xL, sum#x, count#xL]
+        |""".stripMargin,
+      """
+        |(16) BroadcastHashJoin
+        |Left keys [1]: [k#x]
+        |Right keys [1]: [k#x]
+        |Join condition: None
+        |""".stripMargin,
+      """
+        |(19) Exchange
+        |Input [5]: [k#x, count#xL, sum#xL, sum#x, count#xL]
+        |""".stripMargin,
+      """
+        |(21) AdaptiveSparkPlan
+        |Output [4]: [k#x, count(v1)#xL, sum(v1)#xL, avg(v2)#x]
+        |Arguments: isFinalPlan=true
+        |""".stripMargin
     )
+    checkKeywordsNotExistsInExplain(testDf, FormattedMode, "unknown")
+  }
+
+  test("SPARK-35884: Explain should only display one plan before AQE takes 
effect") {

Review comment:
       It's for testing this code path: 
https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanExec.scala#L342




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