Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/5290#discussion_r28200038
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
---
@@ -36,6 +36,58 @@ class SQLQuerySuite extends QueryTest with
BeforeAndAfterAll {
import org.apache.spark.sql.test.TestSQLContext.implicits._
val sqlCtx = TestSQLContext
+ test("SPARK-6583 order by aggregated function") {
+ checkAnswer(
+ sql(
+ """
+ |SELECT a, sum(b) as sum_b
+ |FROM orderByData
+ |GROUP BY a
+ |ORDER BY sum_b
+ """.stripMargin),
+ Row("4", 3) :: Row("1", 7) :: Row("3", 11) :: Row("2", 15) :: Nil)
+
+ checkAnswer(
+ sql(
+ """
+ |SELECT a
+ |FROM orderByData
+ |GROUP BY a
+ |ORDER BY sum(b)
+ """.stripMargin),
+ Row("4") :: Row("1") :: Row("3") :: Row("2") :: Nil)
+
+ checkAnswer(
+ sql(
+ """
+ |SELECT sum(b)
+ |FROM orderByData
+ |GROUP BY a
+ |ORDER BY sum(b)
--- End diff --
What about `ORDER BY sum(b) + 1`.
---
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]