Query in Spark SQL inside an array
<p>To give the backfround I have loaded the JSON using</p>

<pre><code>sqlContext.read.json(sn3://...)
df.registerTable("posts")
</code></pre>

<p>I have the following schema for my table in Spark</p>

<pre><code>scala&gt; posts.printSchema
root
 |-- command: string (nullable = true)
 |-- externalId: string (nullable = true)
 |-- sourceMap: struct (nullable = true)
 |    |-- hashtags: array (nullable = true)
 |    |    |-- element: string (containsNull = true)
 |    |-- url: string (nullable = true)
 |-- type: string (nullable = true)
</code></pre>

<p>I want to select all posts with hashtag "nike"</p>

<pre><code>sqlContext.sql("select sourceMap['hashtags'] as ht from posts where ht.contains('nike')");
</code></pre>

<p>I get an error 
undefined function ht.contains</p>

<p>I am not sure what method to use to search within the array.</p>

<p>Thanks!</p>