title: Getting error like need struct type but got string in spark scala for simple struct type
body: <p>Here is my schema </p>
  
  <pre><code>root
   |-- DataPartition: string (nullable = true)
   |-- TimeStamp: string (nullable = true)
   |-- PeriodId: long (nullable = true)
   |-- FinancialAsReportedLineItemName: struct (nullable = true)
   |    |-- _VALUE: string (nullable = true)
   |    |-- _languageId: long (nullable = true)
   |-- FinancialLineItemSource: long (nullable = true)
   |-- FinancialStatementLineItemSequence: long (nullable = true)
   |-- FinancialStatementLineItemValue: double (nullable = true)
   |-- FiscalYear: long (nullable = true)
   |-- IsAnnual: boolean (nullable = true)
   |-- IsAsReportedCurrencySetManually: boolean (nullable = true)
   |-- IsCombinedItem: boolean (nullable = true)
   |-- IsDerived: boolean (nullable = true)
   |-- IsExcludedFromStandardization: boolean (nullable = true)
   |-- IsFinal: boolean (nullable = true)
   |-- IsTotal: boolean (nullable = true)
   |-- ParentLineItemId: long (nullable = true)
   |-- PeriodPermId: struct (nullable = true)
   |    |-- _VALUE: long (nullable = true)
   |    |-- _objectTypeId: long (nullable = true)
   |-- ReportedCurrencyId: long (nullable = true)
  </code></pre>
  
  <p>From the above schema i am trying to do like this</p>
  
  <pre><code>val temp = tempNew1
        .withColumn("FinancialAsReportedLineItemName", $"FinancialAsReportedLineItemName._VALUE")
        .withColumn("FinancialAsReportedLineItemName_languageId", $"FinancialAsReportedLineItemName._languageId")
        .withColumn("PeriodPermId", $"PeriodPermId._VALUE")
        .withColumn("PeriodPermId_objectTypeId", $"PeriodPermId._objectTypeId").drop($"AsReportedItem").drop($"AsReportedItem")
  </code></pre>
  
  <p>I don't know what i am missing here .
  I get below error </p>
  
  <blockquote>
    <p>Exception in thread "main" org.apache.spark.sql.AnalysisException:
    Can't extract value from FinancialAsReportedLineItemName#2262: need
    struct type but got string;</p>
  </blockquote>