cloud-fan commented on a change in pull request #35473:
URL: https://github.com/apache/spark/pull/35473#discussion_r811614292
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -2484,6 +2491,38 @@ class AdaptiveQueryExecSuite
}
}
}
+
+ test("SPARK-38162: Optimize one row plan in AQE Optimizer") {
+ withTempView("v") {
+ spark.sparkContext.parallelize(
+ (1 to 4).map(i => TestData( i, i.toString)), 2)
+ .toDF("c1", "c2").createOrReplaceTempView("v")
+
+ // remove sort
+ val (origin1, adaptive1) = runAdaptiveAndVerifyResult(
+ """
+ |SELECT * FROM v where c1 = 1 order by c1, c2
+ |""".stripMargin)
+ assert(findTopLevelSort(origin1).size == 1)
+ assert(findTopLevelSort(adaptive1).isEmpty)
+
+ // convert group only aggregate to project
+ val (origin2, adaptive2) = runAdaptiveAndVerifyResult(
+ """
+ |SELECT distinct c1 FROM (SELECT /*+ repartition(c1) */ * FROM v
where c1 = 1)
Review comment:
what happens if there is no `/*+ repartition(c1) */`?
--
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]