title: cannot resolve column due to data type mismatch PySpark
body: <p>Error being faced in PySpark:</p>
  
  <pre><code>pyspark.sql.utils.AnalysisException: "cannot resolve '`result_set`.`dates`.`trackers`['token']' due to data type mismatch: argument 2 requires integral type, however, ''token'' is of string type.;;\n'Project [result_parameters#517, result_set#518, &lt;lambda&gt;(result_set#518.dates.trackers[token]) AS result_set.dates.trackers.token#705]\n+- Relation[result_parameters#517,result_set#518] json\n"
  </code></pre>
  
  <p>Data strucutre:</p>
  
  <pre><code>-- result_set: struct (nullable = true)
   |    |-- currency: string (nullable = true)
   |    |-- dates: array (nullable = true)
   |    |    |-- element: struct (containsNull = true)
   |    |    |    |-- date: string (nullable = true)
   |    |    |    |-- trackers: array (nullable = true)
   |    |    |    |    |-- element: struct (containsNull = true)
   |    |    |    |    |    |-- countries: array (nullable = true)
   |    |    |    |    |    |    |-- element: struct (containsNull = true)
   |    |    |    |    |    |    |    |-- country: string (nullable = true)
   |    |    |    |    |    |    |    |-- os_names: array (nullable = true)
   |    |    |    |    |    |    |    |    |-- element: struct (containsNull = true)
   |    |    |    |    |    |    |    |    |    |-- kpi_values: array (nullable = true)
   |    |    |    |    |    |    |    |    |    |    |-- element: double (containsNull = true)
   |    |    |    |    |    |    |    |    |    |-- os_name: string (nullable = true)
   |    |    |    |    |    |-- token: string (nullable = true)
   |    |-- name: string (nullable = true)
   |    |-- token: string (nullable = true)
  </code></pre>
  
  <p>I am trying to create a view to show currency, date, and token:</p>
  
  <pre><code>df.select('result_set.currency', 'result_set.dates.date', 'result_set.dates.trackers.token').show()
  </code></pre>
  
  <p>Sample of data:</p>
  
  <pre><code>"result_set": {
          "token": "abcdef",
          "name": "Facebook",
          "currency": "EUR",
          "dates": [
              {
                  "date": "2020-03-11",
                  "trackers": [
                      {
                          "token": "12345",
                          "countries": [
                              {
                                  "country": "am",
                                  "os_names": [
                                      {
                                          "os_name": "android",
                                          "kpi_values": [
                                              0,
                                              0,
                                              0,
                                              0,
                                              0,
                                              0,
                                              1,
                                              0,
                                              0
                                          ]
                                      }
                                  ]
                              },
  </code></pre>
  
  <p>I am trying to create a view based on a few of these levels within the json data.</p>
  
  <p>Update:</p>
  
  <p>Duplicating token</p>
  
  <pre><code>df.selectExpr('result_set.currency','explode(result_set.dates)').\
  select("*","col.*").\
  selectExpr("explode(trackers)","*").\
  selectExpr("currency","date","explode(trackers)").\
  select("currency","date","col.*").\
  selectExpr("currency","date","token", "explode(countries)").\
  select("currency","date","token", "col.*").\
  selectExpr("currency","date","token", "country", "explode(os_names)").\
  select("currency","date","token", "country", "col.*").\
  selectExpr("currency","date","token", "country", "os_name", "explode(kpi_values)").\
  show(20)
  </code></pre>
  
  <p>After doing some explodes, now the token repeats 8 times.</p>