title: Apply filter condition on dataframe created from JSON
body: <p>I am working on the dataframe created by JSON and then I want to apply the filter condition over the dataframe.</p>
  
  <pre><code>val jsonStr = """{ "metadata": [{ "key": 84896, "value": 54 },{ "key": 1234, "value": 12 }]}"""
  val rdd = sc.parallelize(Seq(jsonStr))
  val df = sqlContext.read.json(rdd)
  </code></pre>
  
  <p>schema of df </p>
  
  <pre class="lang-none prettyprint-override"><code>root
   |-- metadata: array (nullable = true)
   |    |-- element: struct (containsNull = true)
   |    |    |-- key: long (nullable = true)
   |    |    |-- value: long (nullable = true)
  </code></pre>
  
  <p>now I need to filter the dataframe which I am trying to do as </p>
  
  <pre><code>val df1=df.where("key == 84896")
  </code></pre>
  
  <p>which throws error </p>
  
  <pre class="lang-none prettyprint-override"><code>ERROR Executor - Exception in task 0.0 in stage 1.0 (TID 1)
  org.apache.spark.sql.AnalysisException: cannot resolve '`key`' given input columns: [metadata]; line 1 pos 0;
  'Filter ('key = 84896)
  </code></pre>
  
  <p>The reason I want to use where clause is because of the expression string which I want to use directly 
  eg <code>( (key == 999, value == 55) || (key == 1234, value == 12) )</code></p>