Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/17406#discussion_r107851214
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala ---
@@ -103,6 +106,13 @@ object DataType {
def fromJson(json: String): DataType = parseDataType(parse(json))
+ // Until Spark-2.1, we use json strings for defining schemas in
user-facing APIs.
+ // Since we add an user-friendly API in the DDL parser, we employ DDL
formats for the case.
+ // To keep back-compatibility, we use `fromJson` first, and then try the
new API.
+ def fromString(text: String): DataType = {
--- End diff --
Sorry for interrupting. Actually, my point is a bit different. I thought
`DataType.fromString` should take only the SQL type string with proper
documentation unless we are going to deprecate `DataType.fromJson` on this
purpose, and both cases should be handled whether within `functions.from_json`
or somewhere.
I guess `functions.from_json` refers the data itself is in json format not
the schema. So probably, it is fine if we document this difference.
---
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]