ulysses-you commented on code in PR #37537:
URL: https://github.com/apache/spark/pull/37537#discussion_r947522834
##########
sql/core/src/test/scala/org/apache/spark/sql/CTEInlineSuite.scala:
##########
@@ -485,4 +490,23 @@ abstract class CTEInlineSuiteBase
class CTEInlineSuiteAEOff extends CTEInlineSuiteBase with
DisableAdaptiveExecutionSuite
-class CTEInlineSuiteAEOn extends CTEInlineSuiteBase with
EnableAdaptiveExecutionSuite
+class CTEInlineSuiteAEOn extends CTEInlineSuiteBase with
EnableAdaptiveExecutionSuite {
+ import testImplicits._
+
+ test("SPARK-40105: Improve repartition in ReplaceCTERefWithRepartition") {
+ withTempView("t") {
+ Seq((0, 1), (1, 2)).toDF("c1", "c2").createOrReplaceTempView("t")
+ val df = sql(
+ s"""with
+ |v as (
+ | select /*+ rebalance(c1) */ c1, c2, rand() from t
+ |)
+ |select * from v except select * from v
+ """.stripMargin)
+ checkAnswer(df, Nil)
+
+
assert(!df.queryExecution.optimizedPlan.exists(_.isInstanceOf[RepartitionOperation]))
+
assert(df.queryExecution.optimizedPlan.exists(_.isInstanceOf[RebalancePartitions]))
Review Comment:
rebalance hint can only be resolved with AQE on, so this test does not work
if AQE is disabled.
--
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]