title: How to access value in array of structs?
body: <p>I'm using Spark on Google Cloud to process data from Google Analytics but I don't know how to select custom dimensions based on index</p>
  
  <p>The structure of GA's custom dimension is the fallowing:</p>
  
  <pre><code>ARRAY&lt;STRUCT&lt; index: INTEGER, value:STRING &gt;&gt;
  </code></pre>
  
  <p>Usually, in BigQuery, I would do a subquery to select the data like</p>
  
  <pre><code>SELECT (select value from customDimensions where index = 2)
  </code></pre>
  
  <p>But as explained in <a href="https://cwiki.apache.org/confluence/display/Hive/Subqueries+in+SELECT" rel="nofollow noreferrer">here</a> subquery in select is not yet supported. </p>