<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: When execute &amp;quot;CREATE TABLE&amp;quot; with location by impala will cause privilege error. in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/When-execute-quot-CREATE-TABLE-quot-with-location-by-impala/m-p/83520#M85281</link>
    <description>&lt;P&gt;Congratulations on solving your issue and thank you for marking the solution to assist others in a similar situation. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Dec 2018 14:38:40 GMT</pubDate>
    <dc:creator>cjervis</dc:creator>
    <dc:date>2018-12-10T14:38:40Z</dc:date>
    <item>
      <title>When execute "CREATE TABLE" with location by impala will cause privilege error.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/When-execute-quot-CREATE-TABLE-quot-with-location-by-impala/m-p/83148#M85279</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I enabled sentry for impala and sync to HDFS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mostly working correctly, but when execute &lt;STRONG&gt;"CREATE TABLE" with location&lt;/STRONG&gt; by impala will cause unexpected privilege error.&lt;BR /&gt;Despite having authority to the specified location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CDH Settings&lt;/P&gt;&lt;PRE&gt;hadoop.security.group.mapping: ShellBasedUnixGroupsMapping
hadoop.security.authentication: simple
hive.sentry.provider: HadoopGroupResourceAuthorizationProvider

Authentication is all disabled for hdfs/hive/impala.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Details are described below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. The first case is when location for table directory is not specified.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[root@hostname ~]# su test_user1
[test_user1@hostname ~]$ impala-shell

[hostname.example.com:21000] &amp;gt; CREATE EXTERNAL TABLE `test_db`.`test_table1` (`a` int , `b` int , `c` int ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TextFile TBLPROPERTIES("skip.header.line.count" = "1");
Fetched 0 row(s) in 0.50s&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check the authority of the created impala table directory.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[root@hostname ~]# hdfs dfs -getfacl /user/hive/warehouse/test_db.db/test_table1

# file: /user/hive/warehouse/trial_f2042910.db/test_table1
# owner: hive
# group: hive
user:hive:rwx
&lt;STRONG&gt;user:test_user1:rwx&lt;/STRONG&gt;
group:hive:rwx
group:test_group1:rwx
mask::rwx
other::--x&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The all authority is given to "test_user1".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. The next case is when location for table directory is specified.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[root@hostname ~]# hdfs dfs -getfacl /user/hive/warehouse/test_db.db/test_table2&lt;BR /&gt;
# file: /user/hive/warehouse/test_db.db/test_table2
# owner: hive
# group: hive
user:hive:rwx
&lt;STRONG&gt;user:test_user2:rwx&lt;/STRONG&gt;
group:hive:rwx
group:test_group2:rwx
mask::rwx
other::--x&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The all authority is given to "test_user2".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[root@hostname ~]# su test_user2
[test_user2@hostname ~]$ impala-shell

[hostname.example.com:21000] &amp;gt; CREATE EXTERNAL TABLE `test_db`.`test_table2` (`a` int , `b` int , `c` int ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TextFile LOCATION '/user/hive/warehouse/test_db.db/test_table2' TBLPROPERTIES("skip.header.line.count" = "1");

&lt;STRONG&gt;ERROR: AuthorizationException: User 'test_user2' does not have privileges to access: hdfs://hostname.example.com:8020/user/hive/warehouse/test_db.db/test_table2&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This not worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, with the hdfs command can write without problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[root@hostname ~] su test_user2
[test_user2@hostname ~]$&amp;nbsp;hdfs dfs -put test.csv /user/hive/warehouse/test_db.db/test_table2/&lt;BR /&gt;=&amp;gt; success&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The clues are that there is a difference in the impala deamon log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. The first case is when location for table directory is not specified.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;I1130 19:00:53.146760  3080 impala-hs2-server.cc:418] ExecuteStatement(): request=TExecuteStatementReq {
  01: sessionHandle (struct) = TSessionHandle {
    01: sessionId (struct) = THandleIdentifier {
      01: guid (string) = "&amp;gt;\xfa\xb2|/\xe3J\xde\x978&amp;gt;\xfb\xf9\xc9k\x13",
      02: secret (string) = "p\"a\xee\xd4\xc4G\x1d\x9aOV\xbe6\x17\xa6\x8b",
    },
  },
  02: statement (string) = "CREATE EXTERNAL TABLE `test_db`.`test_table1` (`a` int , `b` int , `c` int ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TextFile TBLPROPERTIES(\"skip.header.line.count\" = \"1\")",
  03: confOverlay (map) = map&amp;lt;string,string&amp;gt;[2] {
    "QUERY_TIMEOUT_S" -&amp;gt; "600",
    "impala.resultset.cache.size" -&amp;gt; "100000",
  },
  04: runAsync (bool) = true,
}&lt;BR /&gt;.&lt;BR /&gt;.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. The next case is when&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;location for table directory is specified.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;I1130 19:08:29.901100 18617 impala-beeswax-server.cc:52] query(): query=CREATE EXTERNAL TABLE `test_db`.`test_table2` (`a` int , `b` int , `c` int ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TextFile LOCATION '/user/hive/warehouse/test_db.db/test_table2' TBLPROPERTIES("skip.header.line.count" = "1")
I1130 19:08:29.901142 18617 impala-beeswax-server.cc:426] query: Query {
  01: query (string) = "CREATE EXTERNAL [...](259)",
  03: configuration (list) = list&amp;lt;string&amp;gt;[0] {
  },
  04: hadoop_user (string) = "test_user2",
}&lt;BR /&gt;.&lt;BR /&gt;.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When location is not specified, the query is executed with ExecuteStatement() method of impala-hs2-server.cc.&lt;/P&gt;&lt;P&gt;But location is specified, the query is executed with query() method of impala-beeswax-server.cc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what is wrong?&lt;/P&gt;&lt;P&gt;Is this a bug?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;uma66.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:56:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/When-execute-quot-CREATE-TABLE-quot-with-location-by-impala/m-p/83148#M85279</guid>
      <dc:creator>uma66</dc:creator>
      <dc:date>2022-09-16T13:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: When execute "CREATE TABLE" with location by impala will cause privilege error.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/When-execute-quot-CREATE-TABLE-quot-with-location-by-impala/m-p/83481#M85280</link>
      <description>&lt;P&gt;The problem was solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had granted privileges with "&lt;SPAN&gt;hdfs dfs -setfacl&lt;/SPAN&gt;" command, but I needed to grant privileges with "&lt;SPAN&gt;GRANT ON URI&lt;/SPAN&gt;" command from impala.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 06:37:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/When-execute-quot-CREATE-TABLE-quot-with-location-by-impala/m-p/83481#M85280</guid>
      <dc:creator>uma66</dc:creator>
      <dc:date>2018-12-10T06:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: When execute "CREATE TABLE" with location by impala will cause privilege error.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/When-execute-quot-CREATE-TABLE-quot-with-location-by-impala/m-p/83520#M85281</link>
      <description>&lt;P&gt;Congratulations on solving your issue and thank you for marking the solution to assist others in a similar situation. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Dec 2018 14:38:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/When-execute-quot-CREATE-TABLE-quot-with-location-by-impala/m-p/83520#M85281</guid>
      <dc:creator>cjervis</dc:creator>
      <dc:date>2018-12-10T14:38:40Z</dc:date>
    </item>
  </channel>
</rss>

