title: Hive permission denied error when connected from spark
body: <p>I'm connecting to Hive metastore from Spark and executing a "create external table" statement. I get this error</p>
  
  <blockquote>
    <p>org.apache.hadoop.hive.ql.metadata.HiveException:
    MetaException(message:java.security.AccessControlException: Permission
    denied: user=hive, access=WRITE,
    inode="/user/mike/test":mike:users:drwxr-xr-x</p>
  </blockquote>
  
  <p>Hive impersonation is set to true in hive-site.xml</p>
  
  <blockquote>
    <p>hive.server2.enable.doAs = true</p>
  </blockquote>
  
  <p>But still error occurs. How to fix this? This is my code snippet and I'm executing it from the user 'mike'</p>
  
  <pre><code>from pyspark import SparkContext
  from pyspark.sql import HiveContext
  
  sc = SparkContext(appName="PythonSQL")
  sqlContext = HiveContext(sc)
  sqlContext.sql("create external table ... location '/user/mike/test')
  </code></pre>