Github user henryr commented on a diff in the pull request: https://github.com/apache/spark/pull/21073#discussion_r183559663 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala --- @@ -56,6 +58,26 @@ class CollectionExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper checkEvaluation(MapValues(m2), null) } + test("Map Concat") { + val m0 = Literal.create(Map("a" -> "1", "b" -> "2"), MapType(StringType, StringType)) + val m1 = Literal.create(Map("c" -> "3", "a" -> "4"), MapType(StringType, StringType)) + val m2 = Literal.create(Map("d" -> "4", "e" -> "5"), MapType(StringType, StringType)) + val mNull = Literal.create(null, MapType(StringType, StringType)) + + // overlapping maps + checkEvaluation(MapConcat(Seq(m0, m1)), + mutable.LinkedHashMap("a" -> "4", "b" -> "2", "c" -> "3")) + // maps with no overlap + checkEvaluation(MapConcat(Seq(m0, m2)), + mutable.LinkedHashMap("a" -> "1", "b" -> "2", "d" -> "4", "e" -> "5")) + // 3 maps + checkEvaluation(MapConcat(Seq(m0, m1, m2)), + mutable.LinkedHashMap("a" -> "4", "b" -> "2", "c" -> "3", "d" -> "4", "e" -> "5")) + // null map + checkEvaluation(MapConcat(Seq(m0, mNull)), --- End diff -- good idea to check `Seq(mNull, m0)` as well in case there's any asymmetry in the way the first argument is handled.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org