You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (JIRA)" <ji...@apache.org> on 2017/09/13 01:14:00 UTC
[jira] [Commented] (SPARK-21513) SQL to_json should support all
column types
[ https://issues.apache.org/jira/browse/SPARK-21513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16163982#comment-16163982 ]
Hyukjin Kwon commented on SPARK-21513:
--------------------------------------
Hi [~jerryshao], would you mind if I ask set the contributor role to the JIRA ID, 'goldmedal' and assign this to him please when you are available?
> SQL to_json should support all column types
> -------------------------------------------
>
> Key: SPARK-21513
> URL: https://issues.apache.org/jira/browse/SPARK-21513
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 2.2.0
> Reporter: Aaron Davidson
> Labels: Starter
> Fix For: 2.3.0
>
>
> The built-in SQL UDF "to_json" currently supports serializing StructType columns, as well as Arrays of StructType columns. If you attempt to use it on a different type, for example a map, you get an error like this:
> {code}
> AnalysisException: cannot resolve 'structstojson(`tags`)' due to data type mismatch: Input type map<string,string> must be a struct or array of structs.;;
> {code}
> This limitation seems arbitrary; if I were to go through the effort of enclosing my map in a struct, it would be serializable. Same thing with any other non-struct type.
> Therefore the desired improvement is to allow to_json to operate directly on any column type. The associated code is [here|https://github.com/apache/spark/blob/86174ea89b39a300caaba6baffac70f3dc702788/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/jsonExpressions.scala#L653].
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org