cloud-fan commented on code in PR #53817:
URL: https://github.com/apache/spark/pull/53817#discussion_r2838245794


##########
sql/core/src/test/scala/org/apache/spark/sql/ExplainSuite.scala:
##########
@@ -941,6 +941,104 @@ class ExplainSuiteAE extends ExplainSuiteHelper with 
EnableAdaptiveExecutionSuit
     results = results.replaceAll("#\\d+", "#x").replaceAll("plan_id=\\d+", 
"plan_id=x")
     assert(results == expectedTree)
   }
+
+  test("SPARK-55052: Verify exposed AQEShuffleRead properties (coalesced and 
coalesced-skewed) " +
+    "in Physical Plan Tree") {
+    withSQLConf(
+      SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+      SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "-1",
+      SQLConf.SKEW_JOIN_SKEWED_PARTITION_THRESHOLD.key -> "100",
+      SQLConf.ADVISORY_PARTITION_SIZE_IN_BYTES.key -> "100",
+      SQLConf.SHUFFLE_PARTITIONS.key -> "10") {
+      withTempView("view1", "skewDataView2") {
+        spark
+          .range(0, 1000, 1, 10)
+          .selectExpr("id % 10 as key1")
+          .createOrReplaceTempView("view1")
+        spark
+          .range(0, 200, 1, 10)
+          .selectExpr("id % 1 as key2")
+          .createOrReplaceTempView("skewDataView2")
+
+        val df = spark.sql("SELECT key1 FROM view1 JOIN skewDataView2 ON key1 
= key2")
+        df.collect()
+
+        // Verify expected FinalPlan substring including AQEShuffleRead 
properties
+        checkKeywordsExistsInExplain(
+          df = df,
+          mode = ExplainMode.fromString("FORMATTED"),
+          keywords = getExpectedFinalPlanWithCoalescedAndSkewedAQEShuffleRead)

Review Comment:
   shall we just check the existence of `AQEShuffleRead (6), coalesced`?



##########
sql/core/src/test/scala/org/apache/spark/sql/ExplainSuite.scala:
##########
@@ -941,6 +941,104 @@ class ExplainSuiteAE extends ExplainSuiteHelper with 
EnableAdaptiveExecutionSuit
     results = results.replaceAll("#\\d+", "#x").replaceAll("plan_id=\\d+", 
"plan_id=x")
     assert(results == expectedTree)
   }
+
+  test("SPARK-55052: Verify exposed AQEShuffleRead properties (coalesced and 
coalesced-skewed) " +
+    "in Physical Plan Tree") {
+    withSQLConf(
+      SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+      SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "-1",
+      SQLConf.SKEW_JOIN_SKEWED_PARTITION_THRESHOLD.key -> "100",
+      SQLConf.ADVISORY_PARTITION_SIZE_IN_BYTES.key -> "100",
+      SQLConf.SHUFFLE_PARTITIONS.key -> "10") {
+      withTempView("view1", "skewDataView2") {
+        spark
+          .range(0, 1000, 1, 10)
+          .selectExpr("id % 10 as key1")
+          .createOrReplaceTempView("view1")
+        spark
+          .range(0, 200, 1, 10)
+          .selectExpr("id % 1 as key2")
+          .createOrReplaceTempView("skewDataView2")
+
+        val df = spark.sql("SELECT key1 FROM view1 JOIN skewDataView2 ON key1 
= key2")
+        df.collect()
+
+        // Verify expected FinalPlan substring including AQEShuffleRead 
properties
+        checkKeywordsExistsInExplain(
+          df = df,
+          mode = ExplainMode.fromString("FORMATTED"),
+          keywords = getExpectedFinalPlanWithCoalescedAndSkewedAQEShuffleRead)
+      }
+    }
+  }
+
+  test("SPARK-55052: Verify exposed AQEShuffleRead properties (local) in 
Physical Plan Tree") {
+    withSQLConf(
+      SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+      SQLConf.COALESCE_PARTITIONS_ENABLED.key -> "true",
+      SQLConf.ADAPTIVE_OPTIMIZER_EXCLUDED_RULES.key -> 
AQEPropagateEmptyRelation.ruleName,
+      SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "1"
+    ) {
+      val df1 = spark.range(10).withColumn("a", $"id")
+      val df2 = spark.range(10).withColumn("b", $"id")
+
+      val joinedDF = df1.where($"a" > 10)
+        .join(df2.where($"b" > 10), Seq("id"), "left_outer")
+      checkAnswer(joinedDF, Seq())
+      joinedDF.collect()
+
+      // Verify expected FinalPlan substring including AQEShuffleRead 
properties
+      checkKeywordsExistsInExplain(
+        df = joinedDF,
+        mode = ExplainMode.fromString("FORMATTED"),
+        keywords = getExpectedFinalPlanWithLocalAQEShuffleRead)

Review Comment:
   ditto



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