Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/11427#discussion_r57002001
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/CollapseProjectSuite.scala
---
@@ -95,4 +95,17 @@ class CollapseProjectSuite extends PlanTest {
comparePlans(optimized, correctAnswer)
}
+
+ test("collapse project into aggregate") {
+ val query = testRelation
+ .groupBy('a, 'b)(('a + 1).as('a_plus_1), 'b)
+ .select('a_plus_1, ('b + 1).as('b_plus_1))
+
+ val optimized = Optimize.execute(query.analyze)
+
+ val correctAnswer = testRelation
+ .groupBy('a, 'b)(('a + 1).as('a_plus_1), ('b +
1).as('b_plus_1)).analyze
+
+ comparePlans(optimized, correctAnswer)
+ }
--- End diff --
Would be nice to add one more test case that contains common
non-deterministic fields.
---
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]