title: hive user insert, but hdfs permission denied
body: <p>The admin user of my hive is named <strong>appuser</strong>.I have create a database named wuchang_test and a table named abtestmsg.
  Yes , I describe the database, the OWNER NAME of this database is appuser and OWNER TYPE is USER ,just like below:</p>
  
  <pre><code>0: jdbc:hive2://hive.data.ms.netease.com:1000&gt; describe database wuchang_test;
  OK
  db_name|comment|location|owner_name|owner_type|parameters
  wuchang_test||hdfs://datahdfsmaster/hive/warehouse/wuchang_test.db|appuser|USER|
  </code></pre>
  
  <p>I have defined a role named <strong>ep_dm</strong> and a user named <strong>bjchenweiyao</strong> of this role;  Also , I have already grant SELECT,DELETE,UPDATE,INSERT of this table to role ep_dm:</p>
  
  <pre><code>database|table|partition|column|principal_name|principal_type|privilege|grant_option|grant_time|grantor
  
  wuchang_test|abtestmsg|||appuser|USER|DELETE|true|1498113549000|appuser
  wuchang_test|abtestmsg|||appuser|USER|INSERT|true|1498113549000|appuser
  wuchang_test|abtestmsg|||appuser|USER|SELECT|true|1498113549000|appuser
  wuchang_test|abtestmsg|||appuser|USER|UPDATE|true|1498113549000|appuser
  wuchang_test|abtestmsg|||ep_dm|ROLE|DELETE|false|1498113687000|appuser
  wuchang_test|abtestmsg|||ep_dm|ROLE|INSERT|false|1498113696000|appuser
  wuchang_test|abtestmsg|||ep_dm|ROLE|SELECT|false|1498113704000|appuser
  wuchang_test|abtestmsg|||ep_dm|ROLE|UPDATE|false|1498113712000|appuser
  </code></pre>
  
  <p>user bjchenweiyao tried to insert some data to table wuchang_test.abtestmsg, but permission denied:</p>
  
  <pre><code>Error: Error while compiling statement: FAILED: RuntimeException Cannot create staging directory 'hdfs://datahdfsmaster/hive/warehouse/wuchang_test.db/abtestmsg/dt=2017-05-01/.hive-staging_hive_2017-06-22_14-55-58_843_8091260031059700585-336': Permission denied: user=bjchenweiyao, access=WRITE, inode="/hive/warehouse/wuchang_test.db/abtestmsg/dt=2017-05-01/.hive-staging_hive_2017-06-22_14-55-58_843_8091260031059700585-336":appuser:supergroup:drwxr-xr-x
  </code></pre>
  
  <p>In order to make user bjchenweiyao to have the write permission for table wuchang_test.abtestmsg, I alter the database owner from USER appuser to ROLE ep_dm:</p>
  
  <pre><code>alter database wuchang_test set owner ROLE ep_dm;
  </code></pre>
  
  <p>or I alter the database owner from USER appuser to USER bjchenweiyao directly:</p>
  
  <pre><code>alter database wuchang_test set owner USER bjchenweiyao;
  </code></pre>
  
  <p>both those methods have tried, but the permission problem is still there.</p>
  
  <p>the database hdfs directory permission is :</p>
  
  <pre><code>[appuser@hz-105 ~]$ hadoop fs -ls /hive/warehouse/wuchang_test.db
  Found 1 items
  drwxr-xr-x   - appuser supergroup          0 2017-06-22 14:39 /hive/warehouse/wuchang_test.db/abtestmsg
  </code></pre>
  
  <p>I know , the user bjchenweiyao has no permission to write to hdfs directory /hive/warehouse/wuchang_test.db/abtestmsg whose permission is drwxr-xr-x . </p>
  
  <p>But what can I do to make bjchenweiyao has the write permission?</p>