Skip to content

Commit 602c33c

Browse files
committed
address comment
1 parent 3859727 commit 602c33c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AQEUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object AQEUtils {
6262
// Analyze the given plan and calculate the required ordering of this plan w.r.t. the
6363
// user-specified sort.
6464
def getRequiredOrdering(p: SparkPlan): Seq[SortOrder] = p match {
65-
// User-specified repartition is only effective when it's the root node, or under
65+
// User-specified sort is only effective when it's the root node, or under
6666
// Project/Filter/CollectMetrics.
6767
case f: FilterExec => getRequiredOrdering(f.child)
6868
case c: CollectMetricsExec => getRequiredOrdering(c.child)

sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,6 +2583,8 @@ class AdaptiveQueryExecSuite
25832583
("key", "key", true),
25842584
("key, value", "key", true)
25852585
).foreach { case (project, sort, required) =>
2586+
// During re-optimize in AQE, the sort will be converted to local relation if it's empty
2587+
// So this test ensure we will add sort back if it is User-specified
25862588
val (origin, adaptive) = runAdaptiveAndVerifyResult(
25872589
s"""
25882590
|SELECT $project FROM testdata where key < 0 ORDER BY $sort

0 commit comments

Comments
 (0)