You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Emiliano Leporati (JIRA)" <ji...@apache.org> on 2015/05/15 18:31:00 UTC
[jira] [Commented] (SPARK-6126) Support UDTs in JSON
[ https://issues.apache.org/jira/browse/SPARK-6126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14545752#comment-14545752 ]
Emiliano Leporati commented on SPARK-6126:
------------------------------------------
With a simple 1-liner path to JsonRDD.enforceCorrectType I've been able to work with a JSON DataFrame with a custom type in the schema:
case udt: UserDefinedType[_] => udt.deserialize(value)
My UDT is a geometry type serialized to GeoJSON, and its deserialize method is smart enough to return an instance from both a String and a Map, that is how the GeoJSON is recognized at first by the JsonRDD.
> Support UDTs in JSON
> --------------------
>
> Key: SPARK-6126
> URL: https://issues.apache.org/jira/browse/SPARK-6126
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 1.3.0
> Reporter: Joseph K. Bradley
>
> This would be nice to do (in Python):
> {code}
> from pyspark.mllib.util import MLUtils
> data = MLUtils.loadLibSVMFile(sc, "data/mllib/sample_libsvm_data.txt")
> data.toDF().toJSON().count()
> {code}
> But UDTs are not yet supported in JSON. It would be nice to add.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org