spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheng Lian (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SPARK-3421) StructField.toString should quote the name field to allow arbitrary character as struct field name
Date Fri, 05 Sep 2014 19:04:29 GMT
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


Mime
View raw message