title: How to cast Array[Struct[String,String]] column type in Hive to Array[Map[String,String]]?
body: <p>I've a column in a Hive table:</p>
  
  <p>Column Name: Filters</p>
  
  <p>Data Type: </p>
  
  <pre><code> |-- filters: array (nullable = true)
   |    |-- element: struct (containsNull = true)
   |    |    |-- name: string (nullable = true)
   |    |    |-- value: string (nullable = true)
  </code></pre>
  
  <p>I want to get the value from this column by it's corresponding name.</p>
  
  <p>What I did so far:</p>
  
  <pre><code>val sdf: DataFrame = sqlContext.sql("select * from &lt;tablename&gt; where id='12345'")
  
  val sdfFilters = sdf.select("filters").rdd.map(r =&gt; r(0).asInstanceOf[Seq[(String,String)]]).collect()
  
  Output: sdfFilters: Array[Seq[(String, String)]] = Array(WrappedArray([filter_RISKFACTOR,OIS.SPD.*], [filter_AGGCODE,IR]), WrappedArray([filter_AGGCODE,IR_]))
  </code></pre>
  
  <p>Note: Casting to Seq because WrappedArray to Map conversion is not possible.</p>
  
  <p>What to do next?</p>