org.apache.spark.sql.types.DataTypeException: Unsupported dataType: IntegerType
<p>I am new to Spark and Scala i am stuck on this exception, I am trying to add some extra fields, i.e. StructField to an existing StructType retrieved from Data Frame for a column using Spark SQL and gettting below exception.</p>

<p>code snippet:</p>

<pre><code>val dfStruct:StructType=parquetDf.select("columnname").schema
dfStruct.add("newField","IntegerType",true)
</code></pre>

<p>Exception in thread "main"</p>

<pre><code> org.apache.spark.sql.types.DataTypeException: Unsupported dataType: IntegerType. If you have a struct and a field name of it has any special characters, please use backticks (`) to quote that field name, e.g. `x+y`. Please note that backtick itself is not supported in a field name.
    at org.apache.spark.sql.types.DataTypeParser$class.toDataType(DataTypeParser.scala:95)
    at org.apache.spark.sql.types.DataTypeParser$$anon$1.toDataType(DataTypeParser.scala:107)
    at org.apache.spark.sql.types.DataTypeParser$.parse(DataTypeParser.scala:111)
</code></pre>

<p>I can see there some open issues running on jira related to this exception but not able to understand much. I am using Spark 1.5.1 version</p>

<p><a href="https://mail-archives.apache.org/mod_mbox/spark-issues/201508.mbox/%3CJIRA.12852533.1438855066000.143133.1440397426473@Atlassian.JIRA%3E" rel="nofollow">https://mail-archives.apache.org/mod_mbox/spark-issues/201508.mbox/%3CJIRA.12852533.1438855066000.143133.1440397426473@Atlassian.JIRA%3E</a></p>

<p><a href="https://mail-archives.apache.org/mod_mbox/spark-issues/201508.mbox/%3CJIRA.12852533.1438855066000.143133.1440397426473@Atlassian.JIRA%3E" rel="nofollow">https://mail-archives.apache.org/mod_mbox/spark-issues/201508.mbox/%3CJIRA.12852533.1438855066000.143133.1440397426473@Atlassian.JIRA%3E</a></p>

<p><a href="https://issues.apache.org/jira/browse/SPARK-9685" rel="nofollow">https://issues.apache.org/jira/browse/SPARK-9685</a></p>