title: Pulling Name Out of Schema in Spark DataFrame
body: <p>I am trying to make a function that will pull the name of the column out of a dataframe schema. So what I have is the initial function defined:</p>
  
  <pre><code>  val df = sqlContext.parquetFile(inputVal.toString)
    val dfSchema = df.schema
  def schemaMatchP(schema: StructType) : Map[String,List[Int]] =
        schema
          // get the 1st word (column type) in upper cases
          .map(columnDescr =&gt; columnDescr
  </code></pre>
  
  <p>If I do something like this:</p>
  
  <pre><code>.map(columnDescr =&gt; columnDescr.toString.split(',')(0).toUpperCase)
  </code></pre>
  
  <p>I will get STRUCTFIELD(HH_CUST_GRP_MBRP_ID,BINARYTYPE,TRUE)</p>
  
  <p>How do you handle a StructField so I can grab the 1st element out of each column for the schema. So my Column names: HH_CUST_GRP_MBRP_ID, etc...</p>