You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Cheng Lian (JIRA)" <ji...@apache.org> on 2014/09/05 21:04:29 UTC

[jira] [Created] (SPARK-3421) StructField.toString should quote the name field to allow arbitrary character as struct field name

Cheng Lian created SPARK-3421:
---------------------------------

             Summary: 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


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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org