Skip to content

Commit

Permalink
[SPARK-9950] [SQL] Wrong Analysis Error for grouping/aggregating on s…
Browse files Browse the repository at this point in the history
…truct fields

This issue has been fixed by #8215, this PR added regression test for it.

Author: Wenchen Fan <cloud0fan@outlook.com>

Closes #8222 from cloud-fan/minor and squashes the following commits:

0bbfb1c [Wenchen Fan] fix style...
7e2d8d9 [Wenchen Fan] add test

(cherry picked from commit a4acdab)
Signed-off-by: Michael Armbrust <michael@databricks.com>
  • Loading branch information
cloud-fan authored and marmbrus committed Aug 17, 2015
1 parent 7279445 commit 76390ec
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,9 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
"""{"a": {"b": 1}}""" :: Nil))
checkAnswer(df.orderBy("a.b"), Row(Row(1)))
}

test("SPARK-9950: correctly analyze grouping/aggregating on struct fields") {
val df = Seq(("x", (1, 1)), ("y", (2, 2))).toDF("a", "b")
checkAnswer(df.groupBy("b._1").agg(sum("b._2")), Row(1, 1) :: Row(2, 2) :: Nil)
}
}

0 comments on commit 76390ec

Please sign in to comment.