Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/7746#discussion_r35732587
--- Diff: python/pyspark/sql/types.py ---
@@ -629,7 +629,7 @@ def jsonValue(self):
@classmethod
def fromJson(cls, json):
- pyUDT = json["pyClass"]
+ pyUDT = str(json["pyClass"])
--- End diff --
@davies If I don't add `str(...)`, I got the following exception in
`ml/clustering.py`:
~~~
File
"/Users/meng/src/spark/python/lib/pyspark.zip/pyspark/sql/types.py", line 636,
in fromJson
m = __import__(pyModule, globals(), locals(), [pyClass])
TypeError: ("Item in ``from list'' not a string", <function
_parse_datatype_json_string at 0x10436a7d0>,
(u'{"type":"struct","fields":[{"name":"features","type":{"type":"udt","class":"org.apache.spark.mllib.linalg.VectorUDT","pyClass":"pyspark.mllib.linalg.VectorUDT","sqlType":{"type":"struct","fields":[{"name":"type","type":"byte","nullable":false,"metadata":{}},{"name":"size","type":"integer","nullable":true,"metadata":{}},{"name":"indices","type":{"type":"array","elementType":"integer","containsNull":false},"nullable":true,"metadata":{}},{"name":"values","type":{"type":"array","elementType":"double","containsNull":false},"nullable":true,"metadata":{}}]}},"nullable":true,"metadata":{}},{"name":"prediction","type":"integer","nullable":true,"metadata":{}}]}',))
~~~
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]