viirya commented on a change in pull request #28900:
URL: https://github.com/apache/spark/pull/28900#discussion_r444240769
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -1026,13 +1026,55 @@ class AdaptiveQueryExecSuite
Seq(true, false).foreach { enableAQE =>
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> enableAQE.toString,
+ SQLConf.COALESCE_PARTITIONS_ENABLED.key -> "true",
SQLConf.SHUFFLE_PARTITIONS.key -> "6",
SQLConf.COALESCE_PARTITIONS_INITIAL_PARTITION_NUM.key -> "7") {
- val partitionsNum =
spark.range(10).repartition($"id").rdd.collectPartitions().length
+ val df1 = spark.range(10).repartition($"id")
+ val df2 = spark.range(10).repartition(10, $"id")
+ val df3 = spark.range(10).repartition(10)
+
+ val partitionsNum1 = df1.rdd.collectPartitions().length
+ if (enableAQE) {
+ assert(partitionsNum1 < 6)
+
+ val plan = df1.queryExecution.executedPlan
+ assert(plan.isInstanceOf[AdaptiveSparkPlanExec])
+ val shuffle =
plan.asInstanceOf[AdaptiveSparkPlanExec].executedPlan.collect {
+ case s: ShuffleExchangeExec => s
+ }
+ assert(shuffle.size == 1)
+ assert(shuffle(0).outputPartitioning.numPartitions == 7)
+ } else {
+ assert(partitionsNum1 === 6)
+ }
+
+ val partitionsNum2 = df2.rdd.collectPartitions().length
+ assert(partitionsNum2 == 10)
Review comment:
fixed.
----------------------------------------------------------------
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]