Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/16933#discussion_r101219684
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CollapseRepartitionSuite.scala
---
@@ -43,15 +55,44 @@ class CollapseRepartitionSuite extends PlanTest {
comparePlans(optimized, correctAnswer)
}
+ test("collapse one coalesce and one repartition into one") {
+ val query1 = testRelation
+ .coalesce(20)
+ .repartition(5)
+
+ val optimized1 = Optimize.execute(query1.analyze)
+ val correctAnswer1 = testRelation.repartition(5).analyze
+
+ comparePlans(optimized1, correctAnswer1)
+
+ val query2 = testRelation
+ .repartition(5)
+ .coalesce(20)
+
+ val optimized2 = Optimize.execute(query2.analyze)
+ val correctAnswer2 = testRelation.repartition(5).coalesce(20).analyze
--- End diff --
that might be the plan but the end result should be numPartitions == 5
correct? is there another suite we could add tests for repartition/coalesce
like this?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]