Skip to content

Commit 5d53ec7

Browse files
committed
Test for MapType in DDL as the root type for from_json
1 parent 41ad77e commit 5d53ec7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ class JsonFunctionsSuite extends QueryTest with SharedSQLContext {
354354

355355
test("SPARK-24027: from_json - map<string, map<string, int>>") {
356356
val in = Seq("""{"a": {"b": 1}}""").toDS()
357-
val schema = MapType(StringType, MapType(StringType, IntegerType))
358-
val out = in.select(from_json($"value", schema))
357+
val schema = "map<string, map<string, int>>"
358+
val out = in.select(from_json($"value", schema, Map.empty[String, String]))
359359

360360
checkAnswer(out, Row(Map("a" -> Map("b" -> 1))))
361361
}

0 commit comments

Comments
 (0)