Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added a round trip tests - from_json and to_json
  • Loading branch information
MaxGekk committed Sep 23, 2018
commit 826e8c3dd5b7e54ebdceee74f30798e1b01bcaed
Original file line number Diff line number Diff line change
Expand Up @@ -518,4 +518,13 @@ class JsonFunctionsSuite extends QueryTest with SharedSQLContext {
jsonDF.select(to_json(from_json($"a", schema))),
Seq(Row(json)))
}

test("pretty print - roundtrip from_json -> to_json") {
val json = """[{"book":{"publisher":[{"country":"NL","year":[1981,1986,1999]}]}}]"""
val jsonDF = Seq(json).toDF("root")

checkAnswer(
jsonDF.select(to_json(from_json($"root", schema_of_json(lit(json))))),
Seq(Row(json)))
}
}