[
https://issues.apache.org/jira/browse/SPARK-3421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Cheng Lian resolved SPARK-3421.
-------------------------------
Resolution: Fixed
> StructField.toString should quote the name field to allow arbitrary character
> as struct field name
> --------------------------------------------------------------------------------------------------
>
> Key: SPARK-3421
> URL: https://issues.apache.org/jira/browse/SPARK-3421
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.0.2
> Reporter: Cheng Lian
> Assignee: Cheng Lian
>
> The original use case is something like this:
> {code}
> // JSON snippet with "illegal" characters in field names
> val json =
> """{ "a(b)": { "c(d)": "hello" } }""" ::
> """{ "a(b)": { "c(d)": "world" } }""" ::
> Nil
> val jsonSchemaRdd = sqlContext.jsonRDD(sparkContext.makeRDD(json))
> jsonSchemaRdd.saveAsParquetFile("/tmp/file.parquet")
> java.lang.Exception: java.lang.RuntimeException: Unsupported dataType:
> StructType(ArrayBuffer(StructField(a(b),StructType(ArrayBuffer(StructField(c(d),StringType,true))),true))),
> [1.37] failure: `,' expected but `(' found
> {code}
> The reason is that, the {{DataType}} parser only allows {{\[a-zA-Z0-9_\]*}}
> as struct field name.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]