Skip to content

Commit 76390ec

Browse files
cloud-fanmarmbrus
authored andcommitted
[SPARK-9950] [SQL] Wrong Analysis Error for grouping/aggregating on struct 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>
1 parent 7279445 commit 76390ec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,4 +873,9 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
873873
"""{"a": {"b": 1}}""" :: Nil))
874874
checkAnswer(df.orderBy("a.b"), Row(Row(1)))
875875
}
876+
877+
test("SPARK-9950: correctly analyze grouping/aggregating on struct fields") {
878+
val df = Seq(("x", (1, 1)), ("y", (2, 2))).toDF("a", "b")
879+
checkAnswer(df.groupBy("b._1").agg(sum("b._2")), Row(1, 1) :: Row(2, 2) :: Nil)
880+
}
876881
}

0 commit comments

Comments
 (0)