You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/10/12 14:29:17 UTC
(datafusion-comet) 01/01: fix: restore localReads assertion in AdaptiveQueryExecSuite diffs (#6382)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-6382-033cb37fe6841adf879a0d340206280b9e77a1fb
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git
commit 0f4811dc4817efebaf5ff6e6f243ab1e098564de
Author: YuLun Mao <93...@users.noreply.github.com>
AuthorDate: Mon Oct 12 12:35:12 2026 +0000
fix: restore localReads assertion in AdaptiveQueryExecSuite diffs (#6382)
* fix: restore localReads assertion in AdaptiveQueryExecSuite diffs
* fix: restore localReads assertion in Spark 3.4.3 diff
---
dev/diffs/3.4.3.diff | 70 +++++++++++++++++++------------------------
dev/diffs/3.5.9.diff | 74 ++++++++++++++++++++-------------------------
dev/diffs/4.0.4.diff | 84 +++++++++++++++++++++++-----------------------------
dev/diffs/4.1.3.diff | 84 +++++++++++++++++++++++-----------------------------
4 files changed, 136 insertions(+), 176 deletions(-)
diff --git a/dev/diffs/3.4.3.diff b/dev/diffs/3.4.3.diff
index af31251b32..1caa75a571 100644
--- a/dev/diffs/3.4.3.diff
+++ b/dev/diffs/3.4.3.diff
@@ -1751,7 +1751,7 @@ index ac710c32296..2854b433dd3 100644
import testImplicits._
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
-index 593bd7bb4ba..47285d87416 100644
+index 593bd7bb4ba..7111252fc44 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -26,9 +26,11 @@ import org.scalatest.time.SpanSugar._
@@ -1862,17 +1862,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80",
-@@ -273,7 +289,8 @@ class AdaptiveQueryExecSuite
- val localReads = collect(adaptivePlan) {
- case read: AQEShuffleReadExec if read.isLocalRead => read
- }
-- assert(localReads.length == 2)
-+ // Comet shuffle changes shuffle metrics
-+ assert(localReads.length == 1)
- val localShuffleRDD0 = localReads(0).execute().asInstanceOf[ShuffledRowRDD]
- val localShuffleRDD1 = localReads(1).execute().asInstanceOf[ShuffledRowRDD]
- // the final parallelism is math.max(1, numReduces / numMappers): math.max(1, 5/2) = 2
-@@ -298,7 +315,9 @@ class AdaptiveQueryExecSuite
+@@ -298,7 +314,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -1883,7 +1873,7 @@ index 593bd7bb4ba..47285d87416 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -312,7 +331,9 @@ class AdaptiveQueryExecSuite
+@@ -312,7 +330,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -1894,7 +1884,7 @@ index 593bd7bb4ba..47285d87416 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -322,7 +343,7 @@ class AdaptiveQueryExecSuite
+@@ -322,7 +342,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -1903,7 +1893,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -337,7 +358,7 @@ class AdaptiveQueryExecSuite
+@@ -337,7 +357,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -1912,7 +1902,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -353,7 +374,7 @@ class AdaptiveQueryExecSuite
+@@ -353,7 +373,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -1921,7 +1911,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -398,7 +419,7 @@ class AdaptiveQueryExecSuite
+@@ -398,7 +418,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -1930,7 +1920,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -443,7 +464,7 @@ class AdaptiveQueryExecSuite
+@@ -443,7 +463,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -1939,7 +1929,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "500") {
-@@ -489,7 +510,7 @@ class AdaptiveQueryExecSuite
+@@ -489,7 +509,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -1948,7 +1938,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -508,7 +529,7 @@ class AdaptiveQueryExecSuite
+@@ -508,7 +528,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -1957,7 +1947,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -539,7 +560,9 @@ class AdaptiveQueryExecSuite
+@@ -539,7 +559,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -1968,7 +1958,7 @@ index 593bd7bb4ba..47285d87416 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.nonEmpty)
-@@ -560,7 +583,9 @@ class AdaptiveQueryExecSuite
+@@ -560,7 +582,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -1979,7 +1969,7 @@ index 593bd7bb4ba..47285d87416 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.isEmpty)
-@@ -569,7 +594,8 @@ class AdaptiveQueryExecSuite
+@@ -569,7 +593,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -1989,7 +1979,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "20000000",
-@@ -664,7 +690,8 @@ class AdaptiveQueryExecSuite
+@@ -664,7 +689,8 @@ class AdaptiveQueryExecSuite
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
// There is still a SMJ, and its two shuffles can't apply local read.
@@ -1999,7 +1989,7 @@ index 593bd7bb4ba..47285d87416 100644
}
}
-@@ -786,7 +813,8 @@ class AdaptiveQueryExecSuite
+@@ -786,7 +812,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2009,7 +1999,7 @@ index 593bd7bb4ba..47285d87416 100644
Seq("SHUFFLE_MERGE", "SHUFFLE_HASH").foreach { joinHint =>
def getJoinNode(plan: SparkPlan): Seq[ShuffledJoin] = if (joinHint == "SHUFFLE_MERGE") {
findTopLevelSortMergeJoin(plan)
-@@ -1004,7 +1032,8 @@ class AdaptiveQueryExecSuite
+@@ -1004,7 +1031,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2019,7 +2009,7 @@ index 593bd7bb4ba..47285d87416 100644
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT key FROM testData GROUP BY key")
-@@ -1599,7 +1628,7 @@ class AdaptiveQueryExecSuite
+@@ -1599,7 +1627,7 @@ class AdaptiveQueryExecSuite
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT id FROM v1 GROUP BY id DISTRIBUTE BY id")
assert(collect(adaptivePlan) {
@@ -2028,7 +2018,7 @@ index 593bd7bb4ba..47285d87416 100644
}.length == 1)
}
}
-@@ -1679,7 +1708,8 @@ class AdaptiveQueryExecSuite
+@@ -1679,7 +1707,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2038,7 +2028,7 @@ index 593bd7bb4ba..47285d87416 100644
def hasRepartitionShuffle(plan: SparkPlan): Boolean = {
find(plan) {
case s: ShuffleExchangeLike =>
-@@ -1864,6 +1894,9 @@ class AdaptiveQueryExecSuite
+@@ -1864,6 +1893,9 @@ class AdaptiveQueryExecSuite
def checkNoCoalescePartitions(ds: Dataset[Row], origin: ShuffleOrigin): Unit = {
assert(collect(ds.queryExecution.executedPlan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -2048,7 +2038,7 @@ index 593bd7bb4ba..47285d87416 100644
}.size == 1)
ds.collect()
val plan = ds.queryExecution.executedPlan
-@@ -1872,6 +1905,9 @@ class AdaptiveQueryExecSuite
+@@ -1872,6 +1904,9 @@ class AdaptiveQueryExecSuite
}.isEmpty)
assert(collect(plan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -2058,7 +2048,7 @@ index 593bd7bb4ba..47285d87416 100644
}.size == 1)
checkAnswer(ds, testData)
}
-@@ -2028,7 +2064,8 @@ class AdaptiveQueryExecSuite
+@@ -2028,7 +2063,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2068,7 +2058,7 @@ index 593bd7bb4ba..47285d87416 100644
withTempView("t1", "t2") {
def checkJoinStrategy(shouldShuffleHashJoin: Boolean): Unit = {
Seq("100", "100000").foreach { size =>
-@@ -2114,7 +2151,8 @@ class AdaptiveQueryExecSuite
+@@ -2114,7 +2150,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2078,7 +2068,7 @@ index 593bd7bb4ba..47285d87416 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
-@@ -2213,7 +2251,7 @@ class AdaptiveQueryExecSuite
+@@ -2213,7 +2250,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2 GROUP BY key1")
val shuffles1 = collect(adaptive1) {
@@ -2087,7 +2077,7 @@ index 593bd7bb4ba..47285d87416 100644
}
assert(shuffles1.size == 3)
// shuffles1.head is the top-level shuffle under the Aggregate operator
-@@ -2226,7 +2264,7 @@ class AdaptiveQueryExecSuite
+@@ -2226,7 +2263,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2")
val shuffles2 = collect(adaptive2) {
@@ -2096,7 +2086,7 @@ index 593bd7bb4ba..47285d87416 100644
}
if (hasRequiredDistribution) {
assert(shuffles2.size == 3)
-@@ -2260,7 +2298,8 @@ class AdaptiveQueryExecSuite
+@@ -2260,7 +2297,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2106,7 +2096,7 @@ index 593bd7bb4ba..47285d87416 100644
CostEvaluator.instantiate(
classOf[SimpleShuffleSortCostEvaluator].getCanonicalName, spark.sparkContext.getConf)
intercept[IllegalArgumentException] {
-@@ -2404,6 +2443,7 @@ class AdaptiveQueryExecSuite
+@@ -2404,6 +2442,7 @@ class AdaptiveQueryExecSuite
val (_, adaptive) = runAdaptiveAndVerifyResult(query)
assert(adaptive.collect {
case sort: SortExec => sort
@@ -2114,7 +2104,7 @@ index 593bd7bb4ba..47285d87416 100644
}.size == 1)
val read = collect(adaptive) {
case read: AQEShuffleReadExec => read
-@@ -2421,7 +2461,8 @@ class AdaptiveQueryExecSuite
+@@ -2421,7 +2460,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2124,7 +2114,7 @@ index 593bd7bb4ba..47285d87416 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_OPTIMIZE_SKEWS_IN_REBALANCE_PARTITIONS_ENABLED.key -> "true",
-@@ -2533,7 +2574,7 @@ class AdaptiveQueryExecSuite
+@@ -2533,7 +2573,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value2 = value3")
val shuffles1 = collect(adaptive1) {
@@ -2133,7 +2123,7 @@ index 593bd7bb4ba..47285d87416 100644
}
assert(shuffles1.size == 4)
val smj1 = findTopLevelSortMergeJoin(adaptive1)
-@@ -2544,7 +2585,7 @@ class AdaptiveQueryExecSuite
+@@ -2544,7 +2584,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value1 = value3")
val shuffles2 = collect(adaptive2) {
@@ -2142,7 +2132,7 @@ index 593bd7bb4ba..47285d87416 100644
}
assert(shuffles2.size == 4)
val smj2 = findTopLevelSortMergeJoin(adaptive2)
-@@ -2703,7 +2744,8 @@ class AdaptiveQueryExecSuite
+@@ -2703,7 +2743,8 @@ class AdaptiveQueryExecSuite
}
}
diff --git a/dev/diffs/3.5.9.diff b/dev/diffs/3.5.9.diff
index 7549996767..67e59a4a32 100644
--- a/dev/diffs/3.5.9.diff
+++ b/dev/diffs/3.5.9.diff
@@ -1947,7 +1947,7 @@ index 5a413c77754..207b66e1d7b 100644
import testImplicits._
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
-index 2f8e401e743..fc4ce35be4b 100644
+index 2f8e401e743..117bd9ffdde 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -27,9 +27,11 @@ import org.scalatest.time.SpanSugar._
@@ -2065,17 +2065,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80",
-@@ -299,7 +316,8 @@ class AdaptiveQueryExecSuite
- val localReads = collect(adaptivePlan) {
- case read: AQEShuffleReadExec if read.isLocalRead => read
- }
-- assert(localReads.length == 2)
-+ // Comet shuffle changes shuffle metrics
-+ assert(localReads.length == 1)
- val localShuffleRDD0 = localReads(0).execute().asInstanceOf[ShuffledRowRDD]
- val localShuffleRDD1 = localReads(1).execute().asInstanceOf[ShuffledRowRDD]
- // the final parallelism is math.max(1, numReduces / numMappers): math.max(1, 5/2) = 2
-@@ -324,7 +342,9 @@ class AdaptiveQueryExecSuite
+@@ -324,7 +341,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -2086,7 +2076,7 @@ index 2f8e401e743..fc4ce35be4b 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -338,7 +358,9 @@ class AdaptiveQueryExecSuite
+@@ -338,7 +357,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -2097,7 +2087,7 @@ index 2f8e401e743..fc4ce35be4b 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -348,7 +370,7 @@ class AdaptiveQueryExecSuite
+@@ -348,7 +369,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2106,7 +2096,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -363,7 +385,7 @@ class AdaptiveQueryExecSuite
+@@ -363,7 +384,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2115,7 +2105,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -379,7 +401,7 @@ class AdaptiveQueryExecSuite
+@@ -379,7 +400,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2124,7 +2114,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -424,7 +446,7 @@ class AdaptiveQueryExecSuite
+@@ -424,7 +445,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2133,7 +2123,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -469,7 +491,7 @@ class AdaptiveQueryExecSuite
+@@ -469,7 +490,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2142,7 +2132,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "500") {
-@@ -515,7 +537,7 @@ class AdaptiveQueryExecSuite
+@@ -515,7 +536,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2151,7 +2141,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -534,7 +556,7 @@ class AdaptiveQueryExecSuite
+@@ -534,7 +555,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2160,7 +2150,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -565,7 +587,9 @@ class AdaptiveQueryExecSuite
+@@ -565,7 +586,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -2171,7 +2161,7 @@ index 2f8e401e743..fc4ce35be4b 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.nonEmpty)
-@@ -586,7 +610,9 @@ class AdaptiveQueryExecSuite
+@@ -586,7 +609,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -2182,7 +2172,7 @@ index 2f8e401e743..fc4ce35be4b 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.isEmpty)
-@@ -595,7 +621,8 @@ class AdaptiveQueryExecSuite
+@@ -595,7 +620,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2192,7 +2182,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "20000000",
-@@ -690,7 +717,8 @@ class AdaptiveQueryExecSuite
+@@ -690,7 +716,8 @@ class AdaptiveQueryExecSuite
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
// There is still a SMJ, and its two shuffles can't apply local read.
@@ -2202,7 +2192,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}
}
-@@ -812,7 +840,8 @@ class AdaptiveQueryExecSuite
+@@ -812,7 +839,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2212,7 +2202,7 @@ index 2f8e401e743..fc4ce35be4b 100644
Seq("SHUFFLE_MERGE", "SHUFFLE_HASH").foreach { joinHint =>
def getJoinNode(plan: SparkPlan): Seq[ShuffledJoin] = if (joinHint == "SHUFFLE_MERGE") {
findTopLevelSortMergeJoin(plan)
-@@ -1030,7 +1059,8 @@ class AdaptiveQueryExecSuite
+@@ -1030,7 +1058,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2222,7 +2212,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT key FROM testData GROUP BY key")
-@@ -1625,7 +1655,7 @@ class AdaptiveQueryExecSuite
+@@ -1625,7 +1654,7 @@ class AdaptiveQueryExecSuite
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT id FROM v1 GROUP BY id DISTRIBUTE BY id")
assert(collect(adaptivePlan) {
@@ -2231,7 +2221,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}.length == 1)
}
}
-@@ -1705,7 +1735,8 @@ class AdaptiveQueryExecSuite
+@@ -1705,7 +1734,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2241,7 +2231,7 @@ index 2f8e401e743..fc4ce35be4b 100644
def hasRepartitionShuffle(plan: SparkPlan): Boolean = {
find(plan) {
case s: ShuffleExchangeLike =>
-@@ -1890,6 +1921,9 @@ class AdaptiveQueryExecSuite
+@@ -1890,6 +1920,9 @@ class AdaptiveQueryExecSuite
def checkNoCoalescePartitions(ds: Dataset[Row], origin: ShuffleOrigin): Unit = {
assert(collect(ds.queryExecution.executedPlan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -2251,7 +2241,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}.size == 1)
ds.collect()
val plan = ds.queryExecution.executedPlan
-@@ -1898,6 +1932,9 @@ class AdaptiveQueryExecSuite
+@@ -1898,6 +1931,9 @@ class AdaptiveQueryExecSuite
}.isEmpty)
assert(collect(plan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -2261,7 +2251,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}.size == 1)
checkAnswer(ds, testData)
}
-@@ -2054,7 +2091,8 @@ class AdaptiveQueryExecSuite
+@@ -2054,7 +2090,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2271,7 +2261,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withTempView("t1", "t2") {
def checkJoinStrategy(shouldShuffleHashJoin: Boolean): Unit = {
Seq("100", "100000").foreach { size =>
-@@ -2140,7 +2178,8 @@ class AdaptiveQueryExecSuite
+@@ -2140,7 +2177,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2281,7 +2271,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
-@@ -2239,7 +2278,7 @@ class AdaptiveQueryExecSuite
+@@ -2239,7 +2277,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2 GROUP BY key1")
val shuffles1 = collect(adaptive1) {
@@ -2290,7 +2280,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}
assert(shuffles1.size == 3)
// shuffles1.head is the top-level shuffle under the Aggregate operator
-@@ -2252,7 +2291,7 @@ class AdaptiveQueryExecSuite
+@@ -2252,7 +2290,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2")
val shuffles2 = collect(adaptive2) {
@@ -2299,7 +2289,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}
if (hasRequiredDistribution) {
assert(shuffles2.size == 3)
-@@ -2286,7 +2325,8 @@ class AdaptiveQueryExecSuite
+@@ -2286,7 +2324,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2309,7 +2299,7 @@ index 2f8e401e743..fc4ce35be4b 100644
CostEvaluator.instantiate(
classOf[SimpleShuffleSortCostEvaluator].getCanonicalName, spark.sparkContext.getConf)
intercept[IllegalArgumentException] {
-@@ -2452,6 +2492,7 @@ class AdaptiveQueryExecSuite
+@@ -2452,6 +2491,7 @@ class AdaptiveQueryExecSuite
val (_, adaptive) = runAdaptiveAndVerifyResult(query)
assert(adaptive.collect {
case sort: SortExec => sort
@@ -2317,7 +2307,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}.size == 1)
val read = collect(adaptive) {
case read: AQEShuffleReadExec => read
-@@ -2469,7 +2510,8 @@ class AdaptiveQueryExecSuite
+@@ -2469,7 +2509,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2327,7 +2317,7 @@ index 2f8e401e743..fc4ce35be4b 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_OPTIMIZE_SKEWS_IN_REBALANCE_PARTITIONS_ENABLED.key -> "true",
-@@ -2581,7 +2623,7 @@ class AdaptiveQueryExecSuite
+@@ -2581,7 +2622,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value2 = value3")
val shuffles1 = collect(adaptive1) {
@@ -2336,7 +2326,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}
assert(shuffles1.size == 4)
val smj1 = findTopLevelSortMergeJoin(adaptive1)
-@@ -2592,7 +2634,7 @@ class AdaptiveQueryExecSuite
+@@ -2592,7 +2633,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value1 = value3")
val shuffles2 = collect(adaptive2) {
@@ -2345,7 +2335,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}
assert(shuffles2.size == 4)
val smj2 = findTopLevelSortMergeJoin(adaptive2)
-@@ -2850,6 +2892,7 @@ class AdaptiveQueryExecSuite
+@@ -2850,6 +2891,7 @@ class AdaptiveQueryExecSuite
}.size == (if (firstAccess) 1 else 0))
assert(collect(initialExecutedPlan) {
case s: SortExec => s
@@ -2353,7 +2343,7 @@ index 2f8e401e743..fc4ce35be4b 100644
}.size == (if (firstAccess) 2 else 0))
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
-@@ -2932,13 +2975,18 @@ class AdaptiveQueryExecSuite
+@@ -2932,13 +2974,18 @@ class AdaptiveQueryExecSuite
val (_, adaptive) = runAdaptiveAndVerifyResult(
"SELECT * FROM t1 WHERE c1 < (SELECT c2 FROM t2)")
@@ -2374,7 +2364,7 @@ index 2f8e401e743..fc4ce35be4b 100644
val emptyDf = spark.range(1).where("false")
val aggDf1 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df1"))
val aggDf2 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df2"))
-@@ -2980,7 +3028,9 @@ class AdaptiveQueryExecSuite
+@@ -2980,7 +3027,9 @@ class AdaptiveQueryExecSuite
val plan = df.queryExecution.executedPlan.asInstanceOf[AdaptiveSparkPlanExec]
assert(plan.inputPlan.isInstanceOf[TakeOrderedAndProjectExec])
diff --git a/dev/diffs/4.0.4.diff b/dev/diffs/4.0.4.diff
index 2133589aa9..83a19b2725 100644
--- a/dev/diffs/4.0.4.diff
+++ b/dev/diffs/4.0.4.diff
@@ -2636,7 +2636,7 @@ index a3cfdc5a240..3793b6191bf 100644
})
checkAnswer(distinctWithId, Seq(Row(1, 0), Row(1, 0)))
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
-index fb8fab6a80f..cfcff43d557 100644
+index fb8fab6a80f..bbe8dcafea8 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -28,12 +28,14 @@ import org.apache.spark.SparkException
@@ -2766,17 +2766,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80",
-@@ -301,7 +327,8 @@ class AdaptiveQueryExecSuite
- val localReads = collect(adaptivePlan) {
- case read: AQEShuffleReadExec if read.isLocalRead => read
- }
-- assert(localReads.length == 2)
-+ // Comet shuffle changes shuffle metrics
-+ assert(localReads.length == 1)
- val localShuffleRDD0 = localReads(0).execute().asInstanceOf[ShuffledRowRDD]
- val localShuffleRDD1 = localReads(1).execute().asInstanceOf[ShuffledRowRDD]
- // the final parallelism is math.max(1, numReduces / numMappers): math.max(1, 5/2) = 2
-@@ -326,7 +353,9 @@ class AdaptiveQueryExecSuite
+@@ -326,7 +352,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -2787,7 +2777,7 @@ index fb8fab6a80f..cfcff43d557 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -340,7 +369,9 @@ class AdaptiveQueryExecSuite
+@@ -340,7 +368,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -2798,7 +2788,7 @@ index fb8fab6a80f..cfcff43d557 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -350,7 +381,7 @@ class AdaptiveQueryExecSuite
+@@ -350,7 +380,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2807,7 +2797,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -365,7 +396,7 @@ class AdaptiveQueryExecSuite
+@@ -365,7 +395,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2816,7 +2806,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -381,7 +412,7 @@ class AdaptiveQueryExecSuite
+@@ -381,7 +411,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2825,7 +2815,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -426,7 +457,7 @@ class AdaptiveQueryExecSuite
+@@ -426,7 +456,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2834,7 +2824,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -471,7 +502,7 @@ class AdaptiveQueryExecSuite
+@@ -471,7 +501,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2843,7 +2833,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "500") {
-@@ -517,7 +548,7 @@ class AdaptiveQueryExecSuite
+@@ -517,7 +547,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2852,7 +2842,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -536,7 +567,7 @@ class AdaptiveQueryExecSuite
+@@ -536,7 +566,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2861,7 +2851,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -567,7 +598,9 @@ class AdaptiveQueryExecSuite
+@@ -567,7 +597,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -2872,7 +2862,7 @@ index fb8fab6a80f..cfcff43d557 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.nonEmpty)
-@@ -588,7 +621,9 @@ class AdaptiveQueryExecSuite
+@@ -588,7 +620,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -2883,7 +2873,7 @@ index fb8fab6a80f..cfcff43d557 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.isEmpty)
-@@ -597,7 +632,8 @@ class AdaptiveQueryExecSuite
+@@ -597,7 +631,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2893,7 +2883,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "20000000",
-@@ -692,7 +728,8 @@ class AdaptiveQueryExecSuite
+@@ -692,7 +727,8 @@ class AdaptiveQueryExecSuite
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
// There is still a SMJ, and its two shuffles can't apply local read.
@@ -2903,7 +2893,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
}
-@@ -814,7 +851,8 @@ class AdaptiveQueryExecSuite
+@@ -814,7 +850,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2913,7 +2903,7 @@ index fb8fab6a80f..cfcff43d557 100644
Seq("SHUFFLE_MERGE", "SHUFFLE_HASH").foreach { joinHint =>
def getJoinNode(plan: SparkPlan): Seq[ShuffledJoin] = if (joinHint == "SHUFFLE_MERGE") {
findTopLevelSortMergeJoin(plan)
-@@ -1096,7 +1134,8 @@ class AdaptiveQueryExecSuite
+@@ -1096,7 +1133,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -2923,7 +2913,7 @@ index fb8fab6a80f..cfcff43d557 100644
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT key FROM testData GROUP BY key")
-@@ -1662,13 +1701,13 @@ class AdaptiveQueryExecSuite
+@@ -1662,13 +1700,13 @@ class AdaptiveQueryExecSuite
val (plan1, adaptivePlan1) = runAdaptiveAndVerifyResult(
"SELECT key FROM testData WHERE key = 0 ORDER BY key, value")
assert(findTopLevelSort(plan1).size == 1)
@@ -2939,7 +2929,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
}
-@@ -1676,18 +1715,18 @@ class AdaptiveQueryExecSuite
+@@ -1676,18 +1714,18 @@ class AdaptiveQueryExecSuite
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
val (plan1, adaptivePlan1) = runAdaptiveAndVerifyResult(
"SELECT key, count(*) FROM testData WHERE value = 'no_match' GROUP BY key")
@@ -2964,7 +2954,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
}
-@@ -1708,7 +1747,7 @@ class AdaptiveQueryExecSuite
+@@ -1708,7 +1746,7 @@ class AdaptiveQueryExecSuite
|""".stripMargin)
checkNumUnion(plan1, 1)
checkNumUnion(adaptivePlan1, 0)
@@ -2973,7 +2963,7 @@ index fb8fab6a80f..cfcff43d557 100644
val (plan2, adaptivePlan2) = runAdaptiveAndVerifyResult(
"""
-@@ -1718,7 +1757,7 @@ class AdaptiveQueryExecSuite
+@@ -1718,7 +1756,7 @@ class AdaptiveQueryExecSuite
|""".stripMargin)
checkNumUnion(plan2, 1)
checkNumUnion(adaptivePlan2, 0)
@@ -2982,7 +2972,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
}
-@@ -1730,7 +1769,7 @@ class AdaptiveQueryExecSuite
+@@ -1730,7 +1768,7 @@ class AdaptiveQueryExecSuite
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT id FROM v1 GROUP BY id DISTRIBUTE BY id")
assert(collect(adaptivePlan) {
@@ -2991,7 +2981,7 @@ index fb8fab6a80f..cfcff43d557 100644
}.length == 1)
}
}
-@@ -1810,7 +1849,8 @@ class AdaptiveQueryExecSuite
+@@ -1810,7 +1848,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3001,7 +2991,7 @@ index fb8fab6a80f..cfcff43d557 100644
def hasRepartitionShuffle(plan: SparkPlan): Boolean = {
find(plan) {
case s: ShuffleExchangeLike =>
-@@ -1995,6 +2035,9 @@ class AdaptiveQueryExecSuite
+@@ -1995,6 +2034,9 @@ class AdaptiveQueryExecSuite
def checkNoCoalescePartitions(ds: Dataset[Row], origin: ShuffleOrigin): Unit = {
assert(collect(ds.queryExecution.executedPlan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -3011,7 +3001,7 @@ index fb8fab6a80f..cfcff43d557 100644
}.size == 1)
ds.collect()
val plan = ds.queryExecution.executedPlan
-@@ -2003,6 +2046,9 @@ class AdaptiveQueryExecSuite
+@@ -2003,6 +2045,9 @@ class AdaptiveQueryExecSuite
}.isEmpty)
assert(collect(plan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -3021,7 +3011,7 @@ index fb8fab6a80f..cfcff43d557 100644
}.size == 1)
checkAnswer(ds, testData)
}
-@@ -2159,7 +2205,8 @@ class AdaptiveQueryExecSuite
+@@ -2159,7 +2204,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3031,7 +3021,7 @@ index fb8fab6a80f..cfcff43d557 100644
withTempView("t1", "t2") {
def checkJoinStrategy(shouldShuffleHashJoin: Boolean): Unit = {
Seq("100", "100000").foreach { size =>
-@@ -2245,7 +2292,8 @@ class AdaptiveQueryExecSuite
+@@ -2245,7 +2291,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3041,7 +3031,7 @@ index fb8fab6a80f..cfcff43d557 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
-@@ -2344,7 +2392,7 @@ class AdaptiveQueryExecSuite
+@@ -2344,7 +2391,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2 GROUP BY key1")
val shuffles1 = collect(adaptive1) {
@@ -3050,7 +3040,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
assert(shuffles1.size == 3)
// shuffles1.head is the top-level shuffle under the Aggregate operator
-@@ -2357,7 +2405,7 @@ class AdaptiveQueryExecSuite
+@@ -2357,7 +2404,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2")
val shuffles2 = collect(adaptive2) {
@@ -3059,7 +3049,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
if (hasRequiredDistribution) {
assert(shuffles2.size == 3)
-@@ -2391,7 +2439,8 @@ class AdaptiveQueryExecSuite
+@@ -2391,7 +2438,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3069,7 +3059,7 @@ index fb8fab6a80f..cfcff43d557 100644
CostEvaluator.instantiate(
classOf[SimpleShuffleSortCostEvaluator].getCanonicalName, spark.sparkContext.getConf)
intercept[IllegalArgumentException] {
-@@ -2557,6 +2606,7 @@ class AdaptiveQueryExecSuite
+@@ -2557,6 +2605,7 @@ class AdaptiveQueryExecSuite
val (_, adaptive) = runAdaptiveAndVerifyResult(query)
assert(adaptive.collect {
case sort: SortExec => sort
@@ -3077,7 +3067,7 @@ index fb8fab6a80f..cfcff43d557 100644
}.size == 1)
val read = collect(adaptive) {
case read: AQEShuffleReadExec => read
-@@ -2574,7 +2624,8 @@ class AdaptiveQueryExecSuite
+@@ -2574,7 +2623,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3087,7 +3077,7 @@ index fb8fab6a80f..cfcff43d557 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_OPTIMIZE_SKEWS_IN_REBALANCE_PARTITIONS_ENABLED.key -> "true",
-@@ -2686,7 +2737,7 @@ class AdaptiveQueryExecSuite
+@@ -2686,7 +2736,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value2 = value3")
val shuffles1 = collect(adaptive1) {
@@ -3096,7 +3086,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
assert(shuffles1.size == 4)
val smj1 = findTopLevelSortMergeJoin(adaptive1)
-@@ -2697,7 +2748,7 @@ class AdaptiveQueryExecSuite
+@@ -2697,7 +2747,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value1 = value3")
val shuffles2 = collect(adaptive2) {
@@ -3105,7 +3095,7 @@ index fb8fab6a80f..cfcff43d557 100644
}
assert(shuffles2.size == 4)
val smj2 = findTopLevelSortMergeJoin(adaptive2)
-@@ -2955,6 +3006,7 @@ class AdaptiveQueryExecSuite
+@@ -2955,6 +3005,7 @@ class AdaptiveQueryExecSuite
}.size == (if (firstAccess) 1 else 0))
assert(collect(initialExecutedPlan) {
case s: SortExec => s
@@ -3113,7 +3103,7 @@ index fb8fab6a80f..cfcff43d557 100644
}.size == (if (firstAccess) 2 else 0))
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
-@@ -2967,6 +3019,7 @@ class AdaptiveQueryExecSuite
+@@ -2967,6 +3018,7 @@ class AdaptiveQueryExecSuite
}.isEmpty)
assert(collect(finalExecutedPlan) {
case s: SortExec => s
@@ -3121,7 +3111,7 @@ index fb8fab6a80f..cfcff43d557 100644
}.isEmpty)
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
-@@ -3042,13 +3095,18 @@ class AdaptiveQueryExecSuite
+@@ -3042,13 +3094,18 @@ class AdaptiveQueryExecSuite
val (_, adaptive) = runAdaptiveAndVerifyResult(
"SELECT * FROM t1 WHERE c1 < (SELECT c2 FROM t2)")
@@ -3142,7 +3132,7 @@ index fb8fab6a80f..cfcff43d557 100644
val emptyDf = spark.range(1).where("false")
val aggDf1 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df1"))
val aggDf2 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df2"))
-@@ -3138,7 +3196,8 @@ class AdaptiveQueryExecSuite
+@@ -3138,7 +3195,8 @@ class AdaptiveQueryExecSuite
val plan = df.queryExecution.executedPlan.asInstanceOf[AdaptiveSparkPlanExec]
assert(plan.inputPlan.isInstanceOf[TakeOrderedAndProjectExec])
diff --git a/dev/diffs/4.1.3.diff b/dev/diffs/4.1.3.diff
index 929fbfd09d..c1714a7357 100644
--- a/dev/diffs/4.1.3.diff
+++ b/dev/diffs/4.1.3.diff
@@ -2807,7 +2807,7 @@ index a3cfdc5a240..3793b6191bf 100644
})
checkAnswer(distinctWithId, Seq(Row(1, 0), Row(1, 0)))
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
-index 188a28ff1c0..d1d8714cd32 100644
+index 188a28ff1c0..5be29a7377d 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
@@ -27,12 +27,14 @@ import org.apache.spark.SparkException
@@ -2937,17 +2937,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80",
-@@ -303,7 +329,8 @@ class AdaptiveQueryExecSuite
- val localReads = collect(adaptivePlan) {
- case read: AQEShuffleReadExec if read.isLocalRead => read
- }
-- assert(localReads.length == 2)
-+ // Comet shuffle changes shuffle metrics
-+ assert(localReads.length == 1)
- val localShuffleRDD0 = localReads(0).execute().asInstanceOf[ShuffledRowRDD]
- val localShuffleRDD1 = localReads(1).execute().asInstanceOf[ShuffledRowRDD]
- // the final parallelism is math.max(1, numReduces / numMappers): math.max(1, 5/2) = 2
-@@ -328,7 +355,9 @@ class AdaptiveQueryExecSuite
+@@ -328,7 +354,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -2958,7 +2948,7 @@ index 188a28ff1c0..d1d8714cd32 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -342,7 +371,9 @@ class AdaptiveQueryExecSuite
+@@ -342,7 +370,9 @@ class AdaptiveQueryExecSuite
.groupBy($"a").count()
checkAnswer(testDf, Seq())
val plan = testDf.queryExecution.executedPlan
@@ -2969,7 +2959,7 @@ index 188a28ff1c0..d1d8714cd32 100644
val coalescedReads = collect(plan) {
case r: AQEShuffleReadExec => r
}
-@@ -352,7 +383,7 @@ class AdaptiveQueryExecSuite
+@@ -352,7 +382,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2978,7 +2968,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -367,7 +398,7 @@ class AdaptiveQueryExecSuite
+@@ -367,7 +397,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2987,7 +2977,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -383,7 +414,7 @@ class AdaptiveQueryExecSuite
+@@ -383,7 +413,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -2996,7 +2986,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -428,7 +459,7 @@ class AdaptiveQueryExecSuite
+@@ -428,7 +458,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -3005,7 +2995,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -473,7 +504,7 @@ class AdaptiveQueryExecSuite
+@@ -473,7 +503,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -3014,7 +3004,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "500") {
-@@ -519,7 +550,7 @@ class AdaptiveQueryExecSuite
+@@ -519,7 +549,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -3023,7 +3013,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -538,7 +569,7 @@ class AdaptiveQueryExecSuite
+@@ -538,7 +568,7 @@ class AdaptiveQueryExecSuite
}
}
@@ -3032,7 +3022,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80") {
-@@ -569,7 +600,9 @@ class AdaptiveQueryExecSuite
+@@ -569,7 +599,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -3043,7 +3033,7 @@ index 188a28ff1c0..d1d8714cd32 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.nonEmpty)
-@@ -590,7 +623,9 @@ class AdaptiveQueryExecSuite
+@@ -590,7 +622,9 @@ class AdaptiveQueryExecSuite
assert(smj.size == 1)
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
@@ -3054,7 +3044,7 @@ index 188a28ff1c0..d1d8714cd32 100644
// Even with local shuffle read, the query stage reuse can also work.
val ex = findReusedExchange(adaptivePlan)
assert(ex.isEmpty)
-@@ -599,7 +634,8 @@ class AdaptiveQueryExecSuite
+@@ -599,7 +633,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3064,7 +3054,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "20000000",
-@@ -694,7 +730,8 @@ class AdaptiveQueryExecSuite
+@@ -694,7 +729,8 @@ class AdaptiveQueryExecSuite
val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
assert(bhj.size == 1)
// There is still a SMJ, and its two shuffles can't apply local read.
@@ -3074,7 +3064,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
}
-@@ -822,7 +859,8 @@ class AdaptiveQueryExecSuite
+@@ -822,7 +858,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3084,7 +3074,7 @@ index 188a28ff1c0..d1d8714cd32 100644
Seq("SHUFFLE_MERGE", "SHUFFLE_HASH").foreach { joinHint =>
def getJoinNode(plan: SparkPlan): Seq[ShuffledJoin] = if (joinHint == "SHUFFLE_MERGE") {
findTopLevelSortMergeJoin(plan)
-@@ -1266,7 +1304,8 @@ class AdaptiveQueryExecSuite
+@@ -1266,7 +1303,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3094,7 +3084,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT key FROM testData GROUP BY key")
-@@ -1832,13 +1871,13 @@ class AdaptiveQueryExecSuite
+@@ -1832,13 +1870,13 @@ class AdaptiveQueryExecSuite
val (plan1, adaptivePlan1) = runAdaptiveAndVerifyResult(
"SELECT key FROM testData WHERE key = 0 ORDER BY key, value")
assert(findTopLevelSort(plan1).size == 1)
@@ -3110,7 +3100,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
}
-@@ -1846,18 +1885,18 @@ class AdaptiveQueryExecSuite
+@@ -1846,18 +1884,18 @@ class AdaptiveQueryExecSuite
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
val (plan1, adaptivePlan1) = runAdaptiveAndVerifyResult(
"SELECT key, count(*) FROM testData WHERE value = 'no_match' GROUP BY key")
@@ -3135,7 +3125,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
}
-@@ -1878,7 +1917,7 @@ class AdaptiveQueryExecSuite
+@@ -1878,7 +1916,7 @@ class AdaptiveQueryExecSuite
|""".stripMargin)
checkNumUnion(plan1, 1)
checkNumUnion(adaptivePlan1, 0)
@@ -3144,7 +3134,7 @@ index 188a28ff1c0..d1d8714cd32 100644
val (plan2, adaptivePlan2) = runAdaptiveAndVerifyResult(
"""
-@@ -1888,7 +1927,7 @@ class AdaptiveQueryExecSuite
+@@ -1888,7 +1926,7 @@ class AdaptiveQueryExecSuite
|""".stripMargin)
checkNumUnion(plan2, 1)
checkNumUnion(adaptivePlan2, 0)
@@ -3153,7 +3143,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
}
-@@ -1900,7 +1939,7 @@ class AdaptiveQueryExecSuite
+@@ -1900,7 +1938,7 @@ class AdaptiveQueryExecSuite
val (_, adaptivePlan) = runAdaptiveAndVerifyResult(
"SELECT id FROM v1 GROUP BY id DISTRIBUTE BY id")
assert(collect(adaptivePlan) {
@@ -3162,7 +3152,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}.length == 1)
}
}
-@@ -1981,7 +2020,8 @@ class AdaptiveQueryExecSuite
+@@ -1981,7 +2019,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3172,7 +3162,7 @@ index 188a28ff1c0..d1d8714cd32 100644
def hasRepartitionShuffle(plan: SparkPlan): Boolean = {
find(plan) {
case s: ShuffleExchangeLike =>
-@@ -2168,6 +2208,9 @@ class AdaptiveQueryExecSuite
+@@ -2168,6 +2207,9 @@ class AdaptiveQueryExecSuite
def checkNoCoalescePartitions(ds: Dataset[Row], origin: ShuffleOrigin): Unit = {
assert(collect(ds.queryExecution.executedPlan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -3182,7 +3172,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}.size == 1)
ds.collect()
val plan = ds.queryExecution.executedPlan
-@@ -2176,6 +2219,9 @@ class AdaptiveQueryExecSuite
+@@ -2176,6 +2218,9 @@ class AdaptiveQueryExecSuite
}.isEmpty)
assert(collect(plan) {
case s: ShuffleExchangeExec if s.shuffleOrigin == origin && s.numPartitions == 2 => s
@@ -3192,7 +3182,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}.size == 1)
checkAnswer(ds, testData)
}
-@@ -2340,7 +2386,8 @@ class AdaptiveQueryExecSuite
+@@ -2340,7 +2385,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3202,7 +3192,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withTempView("t1", "t2") {
def checkJoinStrategy(shouldShuffleHashJoin: Boolean): Unit = {
Seq("100", "100000").foreach { size =>
-@@ -2426,7 +2473,8 @@ class AdaptiveQueryExecSuite
+@@ -2426,7 +2472,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3212,7 +3202,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
-@@ -2525,7 +2573,7 @@ class AdaptiveQueryExecSuite
+@@ -2525,7 +2572,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2 GROUP BY key1")
val shuffles1 = collect(adaptive1) {
@@ -3221,7 +3211,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
assert(shuffles1.size == 3)
// shuffles1.head is the top-level shuffle under the Aggregate operator
-@@ -2538,7 +2586,7 @@ class AdaptiveQueryExecSuite
+@@ -2538,7 +2585,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult(s"SELECT $repartition key1 FROM skewData1 " +
s"JOIN skewData2 ON key1 = key2")
val shuffles2 = collect(adaptive2) {
@@ -3230,7 +3220,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
if (hasRequiredDistribution) {
assert(shuffles2.size == 3)
-@@ -2572,7 +2620,8 @@ class AdaptiveQueryExecSuite
+@@ -2572,7 +2619,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3240,7 +3230,7 @@ index 188a28ff1c0..d1d8714cd32 100644
CostEvaluator.instantiate(
classOf[SimpleShuffleSortCostEvaluator].getCanonicalName, spark.sparkContext.getConf)
intercept[IllegalArgumentException] {
-@@ -2738,6 +2787,7 @@ class AdaptiveQueryExecSuite
+@@ -2738,6 +2786,7 @@ class AdaptiveQueryExecSuite
val (_, adaptive) = runAdaptiveAndVerifyResult(query)
assert(adaptive.collect {
case sort: SortExec => sort
@@ -3248,7 +3238,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}.size == 1)
val read = collect(adaptive) {
case read: AQEShuffleReadExec => read
-@@ -2755,7 +2805,8 @@ class AdaptiveQueryExecSuite
+@@ -2755,7 +2804,8 @@ class AdaptiveQueryExecSuite
}
}
@@ -3258,7 +3248,7 @@ index 188a28ff1c0..d1d8714cd32 100644
withTempView("v") {
withSQLConf(
SQLConf.ADAPTIVE_OPTIMIZE_SKEWS_IN_REBALANCE_PARTITIONS_ENABLED.key -> "true",
-@@ -2867,7 +2918,7 @@ class AdaptiveQueryExecSuite
+@@ -2867,7 +2917,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value2 = value3")
val shuffles1 = collect(adaptive1) {
@@ -3267,7 +3257,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
assert(shuffles1.size == 4)
val smj1 = findTopLevelSortMergeJoin(adaptive1)
-@@ -2878,7 +2929,7 @@ class AdaptiveQueryExecSuite
+@@ -2878,7 +2928,7 @@ class AdaptiveQueryExecSuite
runAdaptiveAndVerifyResult("SELECT key1 FROM skewData1 JOIN skewData2 ON key1 = key2 " +
"JOIN skewData3 ON value1 = value3")
val shuffles2 = collect(adaptive2) {
@@ -3276,7 +3266,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}
assert(shuffles2.size == 4)
val smj2 = findTopLevelSortMergeJoin(adaptive2)
-@@ -3136,6 +3187,7 @@ class AdaptiveQueryExecSuite
+@@ -3136,6 +3186,7 @@ class AdaptiveQueryExecSuite
}.size == (if (firstAccess) 1 else 0))
assert(collect(initialExecutedPlan) {
case s: SortExec => s
@@ -3284,7 +3274,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}.size == (if (firstAccess) 2 else 0))
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
-@@ -3148,6 +3200,7 @@ class AdaptiveQueryExecSuite
+@@ -3148,6 +3199,7 @@ class AdaptiveQueryExecSuite
}.isEmpty)
assert(collect(finalExecutedPlan) {
case s: SortExec => s
@@ -3292,7 +3282,7 @@ index 188a28ff1c0..d1d8714cd32 100644
}.isEmpty)
assert(collect(initialExecutedPlan) {
case i: InMemoryTableScanLike => i
-@@ -3223,13 +3276,18 @@ class AdaptiveQueryExecSuite
+@@ -3223,13 +3275,18 @@ class AdaptiveQueryExecSuite
val (_, adaptive) = runAdaptiveAndVerifyResult(
"SELECT * FROM t1 WHERE c1 < (SELECT c2 FROM t2)")
@@ -3313,7 +3303,7 @@ index 188a28ff1c0..d1d8714cd32 100644
val emptyDf = spark.range(1).where("false")
val aggDf1 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df1"))
val aggDf2 = emptyDf.agg(sum("id").as("id")).withColumn("name", lit("df2"))
-@@ -3319,7 +3377,8 @@ class AdaptiveQueryExecSuite
+@@ -3319,7 +3376,8 @@ class AdaptiveQueryExecSuite
val plan = df.queryExecution.executedPlan.asInstanceOf[AdaptiveSparkPlanExec]
assert(plan.inputPlan.isInstanceOf[TakeOrderedAndProjectExec])
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org