Github user maropu commented on a diff in the pull request: https://github.com/apache/spark/pull/13802#discussion_r67861472 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala --- @@ -457,6 +457,36 @@ class DataFrameAggregateSuite extends QueryTest with SharedSQLContext { ) } + test("collect functions array") { + val df = Seq((1, 3, 3, 3), (2, 3, 3, 3), (3, 4, 1, 2)) + .toDF("a", "x", "y", "z") + .select($"a", array($"x", $"y", $"z").as("b")) + checkAnswer( + df.select(collect_list($"a"), sort_array(collect_list($"b"))), + Seq(Row(Seq(1, 2, 3), Seq(Seq(3, 3, 3), Seq(3, 3, 3), Seq(4, 1, 2)))) + ) + checkAnswer( + df.select(collect_set($"a"), sort_array(collect_set($"b"))), + Seq(Row(Seq(1, 2, 3), Seq(Seq(3, 3, 3), Seq(4, 1, 2)))) + ) + } + + test("collect functions map") { + val df = Seq((1, 3, 0), (2, 3, 0), (3, 4, 1)) + .toDF("a", "x", "y") + .select($"a", map($"x", $"y").as("b")) + checkAnswer( + df.select(collect_list($"a"), collect_list($"b")), + Seq(Row(Seq(1, 2, 3), Seq(Map(3 -> 0), Map(3 -> 0), Map(4 -> 1)))) + ) + // TODO: We need to implement `UnsafeMapData#hashCode` and `UnsafeMapData#equals` for getting + // a set of input data. --- End diff -- Do we need to implement them?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org