-
- Downloads
[SPARK-21954][SQL] JacksonUtils should verify MapType's value type instead of key type
## What changes were proposed in this pull request? `JacksonUtils.verifySchema` verifies if a data type can be converted to JSON. For `MapType`, it now verifies the key type. However, in `JacksonGenerator`, when converting a map to JSON, we only care about its values and create a writer for the values. The keys in a map are treated as strings by calling `toString` on the keys. Thus, we should change `JacksonUtils.verifySchema` to verify the value type of `MapType`. ## How was this patch tested? Added tests. Author: Liang-Chi Hsieh <viirya@gmail.com> Closes #19167 from viirya/test-jacksonutils.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonUtils.scala 3 additions, 1 deletion...ala/org/apache/spark/sql/catalyst/json/JacksonUtils.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/JsonExpressionsSuite.scala 23 additions, 0 deletions...spark/sql/catalyst/expressions/JsonExpressionsSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/JsonFunctionsSuite.scala 21 additions, 3 deletions.../test/scala/org/apache/spark/sql/JsonFunctionsSuite.scala
Please register or sign in to comment