title: How to convert map(key,struct) to map(key,caseclass) in spark scala dataframe
body: <p>I have dataframe schema -</p>
  
  <p>resultDF.printSchema</p>
  
  <pre><code> |-- SKU_ID_MAP: string (nullable = true)
   |-- SKU_IMAGE_MAP: map (nullable = true)
   |    |-- key: string
   |    |-- value: struct (valueContainsNull = true)
   |    |    |-- image_id: string (nullable = true)
   |    |    |-- image_name: string (nullable = true)
   |    |    |-- image_path: string (nullable = true)
  </code></pre>
  
  <p>I want to create a final dataframe like this from above DF.</p>
  
  <pre><code>   case class Devicesku2 (
       sku_id : String,
       sku_images: Map[String, ImageInfo2]
     )
  
     resultDF.map(
        row =&gt; Devicesku2(
                  row.getAs[String]("SKU_ID"),
                  row.getAs[Map]("SKU_IMAGE_MAP")
     ).toDF
  </code></pre>
  
  <p>In above row.getAs[Map] is giving compile time error as value is struct type.</p>
  
  <p>Can someone help on this?
  Thanks,</p>
  
  <p>`</p>