Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -887,4 +887,12 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
.select(struct($"b"))
.collect()
}

test("SPARK-10034: Sort on Aggregate with aggregation expression named 'aggOrdering'") {
val df = Seq(1 -> 2).toDF("i", "j")
val query = df.groupBy('i)
.agg(max('j).as("aggOrdering"))
.orderBy(sum('j))
checkAnswer(query, Row(1, 2))
}
}
10 changes: 10 additions & 0 deletions sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,16 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
""".stripMargin),
Row(3) :: Row(7) :: Row(11) :: Row(15) :: Nil)

checkAnswer(
sql(
"""
|SELECT sum(b)
|FROM orderByData
|GROUP BY a
|ORDER BY sum(b), max(b)
""".stripMargin),
Row(3) :: Row(7) :: Row(11) :: Row(15) :: Nil)

checkAnswer(
sql(
"""
Expand Down