[SPARK-9950] [SQL] Wrong Analysis Error for grouping/aggregating on struct fields

This issue has been fixed by https://github.com/apache/spark/pull/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
This commit is contained in:
Wenchen Fan 2015-08-17 11:36:18 -07:00 committed by Michael Armbrust
parent f68d024096
commit a4acdabb10

View file

@ -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)
}
}