Github user ueshin commented on a diff in the pull request:
https://github.com/apache/spark/pull/21073#discussion_r197064670
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala ---
@@ -633,6 +633,51 @@ class DataFrameFunctionsSuite extends QueryTest with
SharedSQLContext {
checkAnswer(sdf.filter(dummyFilter('m)).select(map_entries('m)),
sExpected)
}
+ test("map_concat function") {
+ val df1 = Seq(
+ (Map[Int, Int](1 -> 100, 2 -> 200), Map[Int, Int](3 -> 300, 4 ->
400)),
+ (Map[Int, Int](1 -> 100, 2 -> 200), Map[Int, Int](3 -> 300, 1 ->
400)),
+ (null, Map[Int, Int](3 -> 300, 4 -> 400))
+ ).toDF("map1", "map2")
+
+ checkAnswer(
+ df1.selectExpr("map_concat(map1, map2)"),
+ Seq(
+ Row(Map(1 -> 100, 2 -> 200, 3 -> 300, 4 -> 400)),
+ Row(Map(1 -> 400, 2 -> 200, 3 -> 300)),
+ Row(null)
+ )
+ )
--- End diff --
Can you add tests using `select(map_concat($"map1", $"map2"))` as well?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]