Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/17406#discussion_r107851721
--- 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 --
`DataType.fromString` should only take DDL format.
`DataType.fromJson` should only take json.
I don't think `functions.from_json` should accept both DDL format and json
like current change does.
Maybe we can add a new `from_ddl` or `from_string` using
`DataType.fromString`, like `from_json` using `DataType.fromJson`?
That is basically my point here. :-)
---
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]