-
Notifications
You must be signed in to change notification settings - Fork 28.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-10437][SQL] Support aggregation expressions in Order By #8599
Changes from all commits
452cfb5
e65f4db
8f73c40
6023c8b
ff532ac
046a8cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1528,6 +1528,26 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext { | |
|ORDER BY sum(b) + 1 | ||
""".stripMargin), | ||
Row("4", 3) :: Row("1", 7) :: Row("3", 11) :: Row("2", 15) :: Nil) | ||
|
||
checkAnswer( | ||
sql( | ||
""" | ||
|SELECT count(*) | ||
|FROM orderByData | ||
|GROUP BY a | ||
|ORDER BY count(*) | ||
""".stripMargin), | ||
Row(2) :: Row(2) :: Row(2) :: Row(2) :: Nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: And also add more typical unit tests like: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. I've added it. |
||
|
||
checkAnswer( | ||
sql( | ||
""" | ||
|SELECT a | ||
|FROM orderByData | ||
|GROUP BY a | ||
|ORDER BY a, count(*), sum(b) | ||
""".stripMargin), | ||
Row("1") :: Row("2") :: Row("3") :: Row("4") :: Nil) | ||
} | ||
|
||
test("SPARK-7952: fix the equality check between boolean and numeric types") { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to set up a stop condition for this rule, or something like
SELECT a, SUM(b) FROM t GROUP BY a ORDER BY a
will go through this rule again and again until reach the fixed point. How about changing the end of this rule to:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've updated it.