Maxim Gekk created SPARK-24445:
----------------------------------

             Summary: Schema in json format for from_json in SQL
                 Key: SPARK-24445
                 URL: https://issues.apache.org/jira/browse/SPARK-24445
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 2.3.0
            Reporter: Maxim Gekk


In Spark 2.3, schema for the from_json function can be specified in JSON format 
in Scala and Python but in SQL. In SQL it is impossible to specify map type for 
example because SQL DDL parser can handle struct type only. Need to support 
schemas in JSON format as it has been already implemented 
[there|https://github.com/apache/spark/blob/branch-2.3/sql/core/src/main/scala/org/apache/spark/sql/functions.scala#L3225-L3229]:
{code:scala}
val dataType = try {
  DataType.fromJson(schema)
} catch {
  case NonFatal(_) => StructType.fromDDL(schema)
}
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to