title: HiveException when running a sql example in Spark shell
body: <p>a newbie in apache spark here! I am using Spark 2.4.0 and Scala version 2.11.12, and I'm trying to run the following code in my spark shell -</p>
  
  <pre class="lang-scala prettyprint-override"><code>import org.apache.spark.sql.SparkSession
  import spark.implicits._
  var df = spark.read.json("storesales.json")
  df.createOrReplaceTempView("storesales")
  spark.sql("SELECT * FROM storesales")
  </code></pre>
  
  <p>And I get the following error -</p>
  
  <pre><code>2018-12-18 07:05:03 WARN  Hive:168 - Failed to access metastore. This class should not accessed in runtime.
  org.apache.hadoop.hive.ql.metadata.HiveException:     java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.
  hive.ql.metadata.SessionHiveMetaStoreClient
      at org.apache.hadoop.hive.ql.metadata.Hive.getAllDatabases(Hive.java:1236)
      at org.apache.hadoop.hive.ql.metadata.Hive.reloadFunctions(Hive.java:174)
      at org.apache.hadoop.hive.ql.metadata.Hive.&lt;clinit&gt;(Hive.java:166)
      at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:503)
      at org.apache.spark.sql.hive.client.HiveClientImpl.newState(HiveClientImpl.scala:183)
      at org.apache.spark.sql.hive.client.HiveClientImpl.&lt;init&gt;(HiveClientImpl.scala:117)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java
  :62) 
  </code></pre>
  
  <p>I also saw this <a href="https://stackoverflow.com/questions/39088433/issues-trying-out-example-in-spark-shell">Issues trying out example in Spark-shell</a> and as per the accepted answer, I have tried to start my spark shell like so,
  <code>~/spark-2.4.0-bin-hadoop2.7/bin/spark-shell --conf spark.sql.warehouse.dir=file:///tmp/spark-warehouse</code>, however, it did not help and the issue persists.</p>