GitHub user maropu opened a pull request: https://github.com/apache/spark/pull/20166
[SPARK-22973][SQL] Fix incorrect results of Casting Map to String ## What changes were proposed in this pull request? This pr fixed the issue when casting maps into strings; ``` scala> Seq(Map(1 -> "a", 2 -> "b")).toDF("a").write.saveAsTable("t") scala> sql("SELECT cast(a as String) FROM t").show(false) +----------------------------------------------------------------+ |a | +----------------------------------------------------------------+ |org.apache.spark.sql.catalyst.expressions.UnsafeMapData@38bdd75d| +----------------------------------------------------------------+ ``` This pr modified the result into; ``` +----------------+ |a | +----------------+ |[1 -> a, 2 -> b]| +----------------+ ``` ## How was this patch tested? Added tests in `CastSuite`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/maropu/spark SPARK-22973 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/20166.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #20166 ---- commit efc28e3aa2a0add8e325d60162090c9ee3fdfcba Author: Takeshi Yamamuro <yamamuro@...> Date: 2018-01-05T14:33:14Z Cast maps to strings ---- --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org