title: dataframe map and hivecontext issue
body: <p>Env: Spark 1.6 and Scala</p>
  
  <p>Hi,</p>
  
  <p>I have dataframe DF and tried to run</p>
  
  <pre><code>val configTable= hivecontext.table("mydb.myTable")
  
  configTable.rdd.map(row=&gt;{
      val abc =hivecontext.sql("select count(*) as num_rows from mydb2.mytable2")
  }).collect()
  </code></pre>
  
  <p>I am getting exception</p>
  
  <pre><code>17/03/28 22:47:04 ERROR executor.Executor: Exception in task 0.0 in stage 1.0 (TID 1)
  java.lang.NullPointerException
  </code></pre>
  
  <p>Is it not allowed to use SparkSQL in <code>rdd.map</code>? Any work around for this?
    Thanks</p>