-
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 1 commit
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 |
---|---|---|
|
@@ -1519,6 +1519,19 @@ 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) | ||
|
||
Seq("1" -> 3, "2" -> 7, "2" -> 8, "3" -> 5, "3" -> 6, "3" -> 2, "4" -> 1, "4" -> 2, | ||
"4" -> 3, "4" -> 4).toDF("a", "b").registerTempTable("orderByData2") | ||
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. Why add 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. For 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. How about Actually we don't need to test the correctness here, only need to make sure 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. Ok. I think it works. |
||
|
||
checkAnswer( | ||
sql( | ||
""" | ||
|SELECT a, count(*) | ||
|FROM orderByData2 | ||
|GROUP BY a | ||
|ORDER BY count(*) | ||
""".stripMargin), | ||
Row("1", 1) :: Row("2", 2) :: Row("3", 3) :: Row("4", 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.