You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "iduanyingjie (Jira)" <ji...@apache.org> on 2019/09/05 07:33:00 UTC
[jira] [Created] (SPARK-28986) from_json cannot handle data with
the same name but different case in the json string.
iduanyingjie created SPARK-28986:
------------------------------------
Summary: from_json cannot handle data with the same name but different case in the json string.
Key: SPARK-28986
URL: https://issues.apache.org/jira/browse/SPARK-28986
Project: Spark
Issue Type: New Feature
Components: SQL
Affects Versions: 2.4.4
Reporter: iduanyingjie
{code:java}
import org.apache.spark.sql.SparkSession
object JsonCaseInsensitive {
case class User(id: String, fields: String)
val users = Seq(User("1", "{\"a\": \"b\"}"), User("2", "{\"A\": \"B\"}"))
def main(args: Array[String]): Unit = {
val spark = SparkSession.builder().master("local").appName("JsonCaseInsensitive").getOrCreate()
import spark.implicits._
spark.createDataset(users)
.selectExpr("id", "from_json(fields, 'a String')")
.show()
}}
{code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org